id
int32
0
12.9k
code
sequencelengths
2
264k
8,400
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "java", ".", "util", ".", "Vector", ";", "public", "class", "SLRowColumnVector", "{", "Vector", "<", "SLCell", ">", "cells", ";", "SLCableTray", "cableTray", ";", "boolean", "isRow", ";", "boolean", "verboseFlag", ";", "public", "SLRowColumnVector", "(", "int", "numCells", ",", "boolean", "asRow", ")", "{", "int", "numTrays", "=", "5", ";", "this", ".", "cells", "=", "new", "Vector", "<", "SLCell", ">", "(", "numCells", ")", ";", "this", ".", "cells", ".", "setSize", "(", "numCells", ")", ";", "this", ".", "cableTray", "=", "new", "SLCableTray", "(", "numTrays", ")", ";", "this", ".", "isRow", "=", "asRow", ";", "this", ".", "verboseFlag", "=", "false", ";", "}", "public", "void", "set", "(", "int", "offset", ",", "SLCell", "cell", ")", "{", "if", "(", "offset", ">", "this", ".", "cells", ".", "size", "(", ")", ")", "this", ".", "cells", ".", "setSize", "(", "offset", ")", ";", "this", ".", "cells", ".", "set", "(", "offset", ",", "cell", ")", ";", "if", "(", "this", ".", "isRow", ")", "cell", ".", "setRow", "(", "this", ")", ";", "else", "cell", ".", "setCol", "(", "this", ")", ";", "}", "public", "SLCell", "get", "(", "int", "offset", ")", "{", "if", "(", "offset", ">", "this", ".", "cells", ".", "size", "(", ")", ")", "return", "null", ";", "return", "this", ".", "cells", ".", "get", "(", "offset", ")", ";", "}", "public", "int", "getOffset", "(", "SLCell", "theCell", ")", "{", "return", "cells", ".", "indexOf", "(", "theCell", ")", ";", "}", "public", "int", "getSize", "(", ")", "{", "int", "theSize", "=", "this", ".", "getSizeNoTray", "(", ")", "+", "this", ".", "cableTray", ".", "getSize", "(", ")", ";", "return", "theSize", ";", "}", "public", "int", "getSizeNoTray", "(", ")", "{", "int", "mySize", "=", "0", ";", "int", "cellSize", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cells", ".", "size", "(", ")", ";", "i", "++", ")", "{", "SLCell", "theCell", "=", "cells", ".", "get", "(", "i", ")", ";", "if", "(", "theCell", "!=", "null", ")", "{", "if", "(", "this", ".", "isRow", ")", "cellSize", "=", "(", "cells", ".", "get", "(", "i", ")", ")", ".", "getMinHeight", "(", ")", ";", "else", "cellSize", "=", "(", "cells", ".", "get", "(", "i", ")", ")", ".", "getMinWidth", "(", ")", ";", "if", "(", "cellSize", ">", "mySize", ")", "mySize", "=", "cellSize", ";", "}", "}", "return", "mySize", ";", "}", "public", "SLCableTray", "getTray", "(", ")", "{", "return", "this", ".", "cableTray", ";", "}", "public", "Integer", "addToTray", "(", "SLSignal", "theSignal", ")", "{", "this", ".", "cableTray", ".", "add", "(", "theSignal", ")", ";", "int", "theOffset", "=", "this", ".", "cableTray", ".", "indexOf", "(", "theSignal", ")", ";", "return", "new", "Integer", "(", "theOffset", ")", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verboseFlag", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verboseFlag", "=", "false", ";", "}", "}", "</s>" ]
8,401
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "OutputStreamWriter", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "HashSet", ";", "public", "class", "SLBlock", "{", "SLDiagram", "ourDiagram", ";", "Block", "block", ";", "BlockArrayList", "children", ";", "int", "rowDepthOfChildren", ";", "int", "myRow", ";", "int", "myCol", ";", "int", "mdlHeight", ";", "int", "mdlWidth", ";", "int", "xPad", ";", "int", "yPad", ";", "HashSet", "<", "String", ">", "writtenTables", ";", "boolean", "verboseFlag", ";", "public", "SLBlock", "(", ")", "{", "this", ".", "myRow", "=", "0", ";", "this", ".", "myCol", "=", "0", ";", "this", ".", "children", "=", "new", "BlockArrayList", "(", "10", ")", ";", "this", ".", "rowDepthOfChildren", "=", "0", ";", "this", ".", "writtenTables", "=", "new", "HashSet", "<", "String", ">", "(", "10", ")", ";", "this", ".", "verboseFlag", "=", "false", ";", "}", "public", "SLBlock", "(", "SLDiagram", "diagram", ",", "Block", "b", ")", "{", "this", "(", ")", ";", "this", ".", "ourDiagram", "=", "diagram", ";", "this", ".", "block", "=", "b", ";", "mdlHeight", "=", "30", ";", "mdlWidth", "=", "30", ";", "xPad", "=", "0", ";", "yPad", "=", "0", ";", "if", "(", "b", "instanceof", "BlockBP", ")", "{", "mdlHeight", "=", "52", ";", "mdlWidth", "=", "50", ";", "xPad", "=", "0", ";", "yPad", "=", "0", ";", "}", "else", "if", "(", "b", "instanceof", "BlockFuncTable", ")", "{", "mdlHeight", "=", "50", ";", "mdlWidth", "=", "50", ";", "xPad", "=", "0", ";", "yPad", "=", "0", ";", "}", "else", "if", "(", "b", "instanceof", "BlockInput", ")", "{", "mdlHeight", "=", "14", ";", "mdlWidth", "=", "30", ";", "xPad", "=", "0", ";", "yPad", "=", "8", ";", "}", "else", "if", "(", "b", "instanceof", "BlockOutput", ")", "{", "mdlHeight", "=", "14", ";", "mdlWidth", "=", "30", ";", "xPad", "=", "0", ";", "yPad", "=", "0", ";", "}", "else", "if", "(", "b", "instanceof", "BlockMathConstant", ")", "{", "mdlHeight", "=", "30", ";", "mdlWidth", "=", "60", ";", "xPad", "=", "0", ";", "yPad", "=", "0", ";", "}", "int", "numInputs", "=", "this", ".", "block", ".", "numInputs", "(", ")", ";", "if", "(", "numInputs", ">", "1", ")", "{", "int", "minHt", "=", "24", "+", "15", "*", "(", "numInputs", "-", "1", ")", ";", "if", "(", "minHt", ">", "mdlHeight", ")", "mdlHeight", "=", "minHt", ";", "}", "}", "public", "void", "createM", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "if", "(", "this", ".", "block", "instanceof", "BlockBP", ")", "{", "writeMforBP", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockFuncTable", ")", "{", "writeMforBFT", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockInput", ")", "{", "writeMforIn", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathAbs", ")", "{", "writeMforAbs", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathConstant", ")", "{", "writeMforConst", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathFunction", ")", "{", "writeMforFunc", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathMinus", ")", "{", "writeMforMinus", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathMinmax", ")", "{", "writeMforMinmax", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathProduct", ")", "{", "writeMforMult", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathRelation", ")", "{", "writeMforRelation", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathSum", ")", "{", "writeMforSum", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockMathSwitch", ")", "{", "writeMforSwitch", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockOutput", ")", "{", "writeMforOut", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockLimiter", ")", "{", "writeMforLimit", "(", "writer", ",", "x", ",", "y", ")", ";", "}", "else", "{", "writer", ".", "writeln", "(", "\"%%\"", ")", ";", "writer", ".", "writeln", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\\\"", "*******\"", ")", ";", "writer", ".", "writeln", "(", "\"\"", "+", "this", ".", "block", ".", "getType", "(", ")", "+", "\"\\\".\"", ")", ";", "writer", ".", "writeln", "(", "\"\"", "+", "this", ".", "block", ".", "getType", "(", ")", "+", "\"\"", "+", "this", ".", "block", ".", "getName", "(", ")", "+", "\"\\\".']);\"", ")", ";", "writer", ".", "writeln", "(", "\"%%\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "}", "}", "public", "void", "writeMforLimit", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockLimiter", "bl", "=", "(", "BlockLimiter", ")", "this", ".", "getBlock", "(", ")", ";", "String", "lowerLim", "=", "\"-Inf\"", ";", "String", "upperLim", "=", "\"Inf\"", ";", "if", "(", "bl", ".", "hasLowerLimit", "(", ")", ")", "lowerLim", "=", "Double", ".", "toString", "(", "bl", ".", "getLowerLimit", "(", ")", ")", ";", "if", "(", "bl", ".", "hasUpperLimit", "(", ")", ")", "upperLim", "=", "Double", ".", "toString", "(", "bl", ".", "getUpperLimit", "(", ")", ")", ";", "String", "paramString", "=", "\"\"", "+", "\"\"", "+", "lowerLim", "+", "\"\"", "+", "upperLim", "+", "\"',\"", "+", "\"\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Saturate\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforBP", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "blockType", "=", "\"\"", ";", "String", "paramString", "=", "\"\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBlock", "(", "blockType", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "writer", ".", "writeln", "(", "\"pts_vec", "=", "'\"", "+", "ourDiagram", ".", "model", ".", "getName", "(", ")", "+", "\"_data.\"", "+", "MDLNameList", ".", "convertToMDLString", "(", "this", ".", "getName", "(", ")", ")", "+", "\"_pts';\"", ")", ";", "String", "maskValues", "=", "\"{pts_vec,\"", "+", "\"\"", "+", "\"'on',\"", "+", "\"'off',\"", "+", "\"'uint32',\"", "+", "\"\"", ";", "if", "(", "this", ".", "ourDiagram", ".", "getWarnOnClip", "(", ")", ")", "maskValues", "+=", "\"'Warning'\"", ";", "else", "maskValues", "+=", "\"'None'\"", ";", "maskValues", "+=", "\"}\"", ";", "writer", ".", "setParam", "(", "this", ".", "getName", "(", ")", ",", "\"MaskValues\"", ",", "maskValues", ")", ";", "writer", ".", "writeln", "(", "\"\"", ")", ";", "}", "public", "void", "writeMforBFT", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockFuncTable", "bft", "=", "(", "BlockFuncTable", ")", "this", ".", "getBlock", "(", ")", ";", "bft", ".", "reorderInputsForMDL", "(", ")", ";", "FuncTable", "ft", "=", "bft", ".", "getFunctionTableDef", "(", ")", ";", "int", "numDim", "=", "ft", ".", "numDim", "(", ")", ";", "String", "blockType", "=", "\"\"", ";", "String", "paramString", "=", "\"\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBlock", "(", "blockType", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "String", "tableName", "=", "ourDiagram", ".", "model", ".", "getName", "(", ")", "+", "\"_data.\"", "+", "MDLNameList", ".", "convertToMDLString", "(", "ft", ".", "getGTID", "(", ")", ")", ";", "String", "maskValues", "=", "\"{\"", ";", "if", "(", "numDim", ">", "4", ")", "maskValues", "+=", "\"'More...'\"", ";", "else", "maskValues", "+=", "\"'\"", "+", "numDim", "+", "\"',\"", ";", "maskValues", "+=", "\"'\"", "+", "numDim", "+", "\"',\"", "+", "\"'\"", "+", "tableName", "+", "\"',\"", "+", "\"'Linear',\"", "+", "\"\"", ";", "if", "(", "this", ".", "ourDiagram", ".", "getWarnOnClip", "(", ")", ")", "maskValues", "+=", "\"'Warning',\"", ";", "else", "maskValues", "+=", "\"'None',\"", ";", "maskValues", "+=", "\"'0'}\"", ";", "writer", ".", "setParam", "(", "this", ".", "getName", "(", ")", ",", "\"MaskValues\"", ",", "maskValues", ")", ";", "}", "public", "void", "writeMforIn", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockInput", "bin", "=", "(", "BlockInput", ")", "this", ".", "getBlock", "(", ")", ";", "int", "seqNumber", "=", "bin", ".", "getSeqNumber", "(", ")", ";", "String", "blockName", "=", "this", ".", "getName", "(", ")", ";", "ourDiagram", ".", "addInput", "(", "seqNumber", ",", "blockName", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Inport\"", ",", "blockName", ",", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ")", ";", "}", "public", "void", "writeMforOut", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockOutput", "bout", "=", "(", "BlockOutput", ")", "this", ".", "getBlock", "(", ")", ";", "int", "seqNumber", "=", "bout", ".", "getSeqNumber", "(", ")", ";", "String", "blockName", "=", "this", ".", "getName", "(", ")", ";", "ourDiagram", ".", "addOutput", "(", "seqNumber", ",", "blockName", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Outport\"", ",", "blockName", ",", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ")", ";", "}", "public", "void", "writeMforAbs", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "writer", ".", "addBuiltInBlock", "(", "\"Abs\"", ",", "this", ".", "getName", "(", ")", ",", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ")", ";", "}", "public", "void", "writeMforConst", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockMathConstant", "bconst", "=", "(", "BlockMathConstant", ")", "this", ".", "getBlock", "(", ")", ";", "String", "myValue", "=", "bconst", ".", "getValueAsString", "(", ")", ";", "String", "paramString", "=", "\"\"", "+", "myValue", "+", "\"',\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Constant\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforFunc", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockMathFunction", "bmf", "=", "(", "BlockMathFunction", ")", "this", ".", "getBlock", "(", ")", ";", "String", "funcType", "=", "bmf", ".", "getFuncType", "(", ")", ";", "String", "blockType", ";", "String", "operatorType", ";", "if", "(", "funcType", ".", "equals", "(", "\"power\"", ")", ")", "{", "blockType", "=", "\"Math\"", ";", "operatorType", "=", "\"pow\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"floor\"", ")", ")", "{", "blockType", "=", "\"Rounding\"", ";", "operatorType", "=", "\"floor\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"ceiling\"", ")", ")", "{", "blockType", "=", "\"Rounding\"", ";", "operatorType", "=", "\"ceil\"", ";", "}", "else", "{", "blockType", "=", "\"Trigonometry\"", ";", "operatorType", "=", "funcType", ";", "if", "(", "funcType", ".", "equals", "(", "\"arcsin\"", ")", ")", "operatorType", "=", "\"asin\"", ";", "if", "(", "funcType", ".", "equals", "(", "\"arccos\"", ")", ")", "operatorType", "=", "\"acos\"", ";", "if", "(", "funcType", ".", "equals", "(", "\"arctan\"", ")", ")", "operatorType", "=", "\"atan\"", ";", "}", "String", "paramString", "=", "\"\"", "+", "\"'Operator','\"", "+", "operatorType", "+", "\"',\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "blockType", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforMinus", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "paramString", ";", "int", "numArgs", "=", "this", ".", "block", ".", "numInputs", "(", ")", ";", "if", "(", "numArgs", "==", "1", ")", "{", "paramString", "=", "\"'Gain','-1',\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Gain\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "if", "(", "numArgs", "==", "2", ")", "{", "paramString", "=", "\"\"", ";", "paramString", "+=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Sum\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "}", "public", "void", "writeMforMinmax", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "paramString", ";", "BlockMathMinmax", "bmm", "=", "(", "BlockMathMinmax", ")", "this", ".", "block", ";", "int", "numArgs", "=", "bmm", ".", "numInputs", "(", ")", ";", "if", "(", "numArgs", "==", "1", ")", "{", "paramString", "=", "\"'Gain','1',\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Gain\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "if", "(", "numArgs", ">=", "2", ")", "{", "paramString", "=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "paramString", "+=", "\"\"", "+", "bmm", ".", "getFuncType", "(", ")", "+", "\"'\"", ";", "paramString", "+=", "\",'Inputs',", "'\"", "+", "numArgs", "+", "\"'\"", ";", "writer", ".", "addBuiltInBlock", "(", "\"MinMax\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "}", "public", "void", "writeMforMult", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockMathProduct", "bmp", "=", "(", "BlockMathProduct", ")", "this", ".", "getBlock", "(", ")", ";", "String", "blockType", "=", "bmp", ".", "getBlockType", "(", ")", ";", "String", "inputs", ";", "if", "(", "blockType", ".", "equals", "(", "\"times\"", ")", ")", "inputs", "=", "\"'\"", "+", "this", ".", "getBlock", "(", ")", ".", "numInputs", "(", ")", "+", "\"'\"", ";", "else", "inputs", "=", "\"'*/'\"", ";", "String", "paramString", "=", "\"\"", "+", "\"\"", "+", "inputs", "+", "\",\"", "+", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Product\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforRelation", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "BlockMathRelation", "bmr", "=", "(", "BlockMathRelation", ")", "this", ".", "getBlock", "(", ")", ";", "String", "relationOp", "=", "bmr", ".", "getRelationOp", "(", ")", ";", "String", "paramString", "=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", "+", "\",'Operator',\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"lt\"", ")", ")", "paramString", "+=", "\"'<'\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"leq\"", ")", ")", "paramString", "+=", "\"'<='\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"eq\"", ")", ")", "paramString", "+=", "\"'=='\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"geq\"", ")", ")", "paramString", "+=", "\"'>='\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"gt\"", ")", ")", "paramString", "+=", "\"'>'\"", ";", "if", "(", "relationOp", ".", "equals", "(", "\"neq\"", ")", ")", "paramString", "+=", "\"'~='\"", ";", "writer", ".", "addBuiltInBlock", "(", "\"\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforSum", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "signs", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "getBlock", "(", ")", ".", "numInputs", "(", ")", ";", "i", "++", ")", "signs", "=", "signs", "+", "\"+\"", ";", "String", "paramString", "=", "\"\"", "+", "signs", "+", "\"',\"", ";", "paramString", "+=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Sum\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforNode", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "paramString", "=", "\"'Gain','1',\"", ";", "paramString", "+=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Gain\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "public", "void", "writeMforSwitch", "(", "SLFileWriter", "writer", ",", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "String", "paramString", "=", "\"\"", ";", "paramString", "+=", "this", ".", "createPositionString", "(", "x", ",", "y", ")", ";", "writer", ".", "addBuiltInBlock", "(", "\"Switch\"", ",", "this", ".", "getName", "(", ")", ",", "paramString", ")", ";", "}", "String", "createPositionString", "(", "int", "x", ",", "int", "y", ")", "throws", "IOException", "{", "int", "x0", "=", "x", "-", "this", ".", "mdlWidth", "/", "2", "+", "this", ".", "xPad", ";", "int", "y0", "=", "y", "-", "this", ".", "mdlHeight", "/", "2", "+", "this", ".", "yPad", ";", "String", "paramLine", "=", "\"'Position',[\"", "+", "x0", "+", "\",\"", "+", "y0", "+", "\",\"", "+", "(", "x0", "+", "this", ".", "mdlWidth", ")", "+", "\",\"", "+", "(", "y0", "+", "this", ".", "mdlHeight", ")", "+", "\"]\"", ";", "return", "paramLine", ";", "}", "public", "void", "writeMat", "(", "MatFileWriter", "writer", ")", "throws", "IOException", "{", "if", "(", "this", ".", "block", "instanceof", "BlockFuncTable", ")", "{", "BlockFuncTable", "bft", "=", "(", "BlockFuncTable", ")", "this", ".", "block", ";", "FuncTable", "ft", "=", "bft", ".", "getFunctionTableDef", "(", ")", ";", "String", "tableName", "=", "MDLNameList", ".", "convertToMDLString", "(", "ft", ".", "getGTID", "(", ")", ")", ";", "if", "(", "!", "this", ".", "writtenTables", ".", "contains", "(", "tableName", ")", ")", "{", "writer", ".", "writeln", "(", "\"%%", "Block", "\\\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "writer", ".", "writeMatrix", "(", "ourDiagram", ".", "model", ".", "getName", "(", ")", "+", "\"_data.\"", "+", "tableName", ",", "ft", ".", "getValues", "(", ")", ",", "ft", ".", "getDimensions", "(", ")", ")", ";", "this", ".", "writtenTables", ".", "add", "(", "tableName", ")", ";", "}", "else", "{", "writer", ".", "writeln", "(", "\"%%", "Block", "\\\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "tableName", "+", "\"'.\"", ")", ";", "}", "}", "else", "if", "(", "this", ".", "block", "instanceof", "BlockBP", ")", "{", "BreakpointSet", "bpSet", "=", "(", "(", "BlockBP", ")", "this", ".", "getBlock", "(", ")", ")", ".", "getBPset", "(", ")", ";", "writer", ".", "writeln", "(", "\"%%", "Block", "\\\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "writer", ".", "writeln", "(", "ourDiagram", ".", "model", ".", "getName", "(", ")", "+", "\"_data.\"", "+", "MDLNameList", ".", "convertToMDLString", "(", "this", ".", "getName", "(", ")", ")", "+", "\"_pts", "=", "[\"", "+", "bpSet", ".", "values", "(", ")", "+", "\"];\"", ")", ";", "}", "else", "{", "writer", ".", "writeln", "(", "\"%%", "Block", "\\\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "}", "public", "int", "getRow", "(", ")", "{", "return", "this", ".", "myRow", ";", "}", "public", "int", "getCol", "(", ")", "{", "return", "this", ".", "myCol", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "block", ".", "getName", "(", ")", ";", "}", "public", "int", "getMDLWidth", "(", ")", "{", "return", "this", ".", "mdlWidth", ";", "}", "public", "int", "getMDLHeight", "(", ")", "{", "return", "this", ".", "mdlHeight", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "if", "(", "this", ".", "block", "!=", "null", ")", "this", ".", "block", ".", "makeVerbose", "(", ")", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verboseFlag", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verboseFlag", "=", "false", ";", "if", "(", "this", ".", "block", "!=", "null", ")", "this", ".", "block", ".", "silence", "(", ")", ";", "}", "public", "Block", "getBlock", "(", ")", "{", "return", "this", ".", "block", ";", "}", "public", "void", "findChildren", "(", ")", "{", "this", ".", "findChildren", "(", "\"", "\"", ")", ";", "}", "private", "void", "findChildren", "(", "String", "prefix", ")", "{", "Signal", "sig", "=", "null", ";", "BlockArrayList", "blks", ";", "Block", "kid", ";", "if", "(", "children", ".", "size", "(", ")", "==", "0", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "block", ".", "getName", "(", ")", "+", "\"'...\"", ")", ";", "}", "sig", "=", "this", ".", "block", ".", "getOutput", "(", ")", ";", "if", "(", "sig", "!=", "null", ")", "{", "blks", "=", "sig", ".", "getDests", "(", ")", ";", "if", "(", "blks", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "block", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "else", "{", "for", "(", "Iterator", "<", "Block", ">", "iBlk", "=", "blks", ".", "iterator", "(", ")", ";", "iBlk", ".", "hasNext", "(", ")", ";", ")", "{", "kid", "=", "iBlk", ".", "next", "(", ")", ";", "children", ".", "add", "(", "kid", ")", ";", "SLBlock", "kidSLBlock", "=", "(", "SLBlock", ")", "kid", ".", "getMask", "(", ")", ";", "if", "(", "kidSLBlock", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"Block", "\"", "+", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "kidSLBlock", ".", "findChildren", "(", "prefix", "+", "\"", "\"", ")", ";", "}", "}", "}", "}", "}", "public", "int", "setPosition", "(", "int", "minimumRow", ",", "int", "minimumCol", ",", "String", "prefix", ")", "{", "Block", "kid", "=", "null", ";", "if", "(", "this", ".", "myRow", "==", "0", ")", "this", ".", "myRow", "=", "minimumRow", ";", "if", "(", "minimumCol", ">", "this", ".", "myCol", ")", "this", ".", "myCol", "=", "minimumCol", ";", "this", ".", "rowDepthOfChildren", "=", "myRow", ";", "int", "offset", "=", "0", ";", "for", "(", "Iterator", "<", "?", ">", "ikid", "=", "children", ".", "iterator", "(", ")", ";", "ikid", ".", "hasNext", "(", ")", ";", ")", "{", "kid", "=", "(", "Block", ")", "ikid", ".", "next", "(", ")", ";", "SLBlock", "kidSLBlock", "=", "(", "SLBlock", ")", "kid", ".", "getMask", "(", ")", ";", "if", "(", "kidSLBlock", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "kid", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "int", "returnedRow", "=", "kidSLBlock", ".", "setPosition", "(", "this", ".", "rowDepthOfChildren", "+", "offset", ",", "this", ".", "myCol", "+", "1", ",", "(", "prefix", "+", "\"", "\"", ")", ")", ";", "if", "(", "this", ".", "rowDepthOfChildren", "<", "returnedRow", ")", "this", ".", "rowDepthOfChildren", "=", "returnedRow", ";", "offset", "=", "1", ";", "}", "if", "(", "myRow", ">", "this", ".", "rowDepthOfChildren", ")", "return", "myRow", ";", "else", "return", "this", ".", "rowDepthOfChildren", ";", "}", "public", "int", "setPosition", "(", "int", "minRow", ",", "int", "minCol", ")", "{", "return", "setPosition", "(", "minRow", ",", "minCol", ",", "\"", "\"", ")", ";", "}", "public", "void", "setRowCol", "(", "int", "theRow", ",", "int", "theCol", ")", "{", "myRow", "=", "theRow", ";", "myCol", "=", "theCol", ";", "return", ";", "}", "public", "int", "findChildrensFarthestColumn", "(", ")", "{", "Block", "kid", "=", "null", ";", "int", "farthest", "=", "this", ".", "myCol", ";", "for", "(", "Iterator", "<", "Block", ">", "ikid", "=", "children", ".", "iterator", "(", ")", ";", "ikid", ".", "hasNext", "(", ")", ";", ")", "{", "kid", "=", "ikid", ".", "next", "(", ")", ";", "SLBlock", "kidSLBlock", "=", "(", "SLBlock", ")", "kid", ".", "getMask", "(", ")", ";", "if", "(", "kidSLBlock", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "kid", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "int", "kidsCol", "=", "kidSLBlock", ".", "findChildrensFarthestColumn", "(", ")", ";", "if", "(", "kidsCol", ">", "farthest", ")", "farthest", "=", "kidsCol", ";", "}", "return", "farthest", ";", "}", "public", "int", "findChildrensDeepestRow", "(", ")", "{", "Block", "kid", "=", "null", ";", "int", "deepest", "=", "this", ".", "myRow", ";", "for", "(", "Iterator", "<", "Block", ">", "ikid", "=", "children", ".", "iterator", "(", ")", ";", "ikid", ".", "hasNext", "(", ")", ";", ")", "{", "kid", "=", "ikid", ".", "next", "(", ")", ";", "SLBlock", "kidSLBlock", "=", "(", "SLBlock", ")", "kid", ".", "getMask", "(", ")", ";", "if", "(", "kidSLBlock", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "kid", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "int", "kidsRow", "=", "kidSLBlock", ".", "findChildrensDeepestRow", "(", ")", ";", "if", "(", "kidsRow", ">", "deepest", ")", "deepest", "=", "kidsRow", ";", "}", "return", "deepest", ";", "}", "public", "static", "int", "printTable", "(", "Writer", "writer", ",", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ",", "int", "startIndex", ")", "throws", "IOException", "{", "int", "offset", ";", "int", "i", ";", "switch", "(", "dims", ".", "length", ")", "{", "case", "0", ":", "return", "0", ";", "case", "1", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "Double", "theValue", "=", "table", ".", "get", "(", "i", "+", "startIndex", ")", ";", "writer", ".", "write", "(", "theValue", ".", "toString", "(", ")", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "}", "return", "i", ";", "case", "2", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "1", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "offset", "=", "printTable", "(", "writer", ",", "table", ",", "newDims", ",", "startIndex", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "writer", ".", "write", "(", "\"n\"", ")", ";", "startIndex", "=", "startIndex", "+", "offset", ";", "}", "return", "startIndex", ";", "default", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "1", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "offset", "=", "printTable", "(", "writer", ",", "table", ",", "newDims", ",", "startIndex", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "writer", ".", "write", "(", "\"n\"", ")", ";", "startIndex", "=", "startIndex", "+", "offset", ";", "}", "return", "startIndex", ";", "}", "}", "public", "static", "void", "printTable", "(", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ")", "throws", "IOException", "{", "OutputStreamWriter", "osw", "=", "new", "OutputStreamWriter", "(", "System", ".", "out", ")", ";", "printTable", "(", "osw", ",", "table", ",", "dims", ",", "0", ")", ";", "}", "public", "static", "void", "printTable", "(", "Writer", "writer", ",", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ")", "throws", "IOException", "{", "printTable", "(", "writer", ",", "table", ",", "dims", ",", "0", ")", ";", "}", "}", "</s>" ]
8,402
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "Block", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "BlockArrayList", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "Signal", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "SLSignal", "extends", "Signal", "{", "SLDiagram", "parentDiagram", ";", "SLCell", "sourceCell", ";", "SLCell", "destCell", ";", "ArrayList", "<", "SLBranch", ">", "branches", ";", "SLLineSegment", "path", ";", "public", "SLSignal", "(", ")", "{", "super", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "this", ".", "parentDiagram", "=", "null", ";", "this", ".", "sourceCell", "=", "null", ";", "this", ".", "branches", "=", "new", "ArrayList", "<", "SLBranch", ">", "(", "10", ")", ";", "this", ".", "path", "=", "null", ";", "}", "public", "SLSignal", "(", "Signal", "oldSignal", ",", "SLDiagram", "theParentDiagram", ")", "{", "super", "(", "oldSignal", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "oldSignal", ".", "getName", "(", ")", ")", ";", "this", ".", "parentDiagram", "=", "theParentDiagram", ";", "if", "(", "this", ".", "getSource", "(", ")", "!=", "null", ")", "{", "Block", "b", "=", "this", ".", "getSource", "(", ")", ";", "SLBlock", "slb", "=", "(", "SLBlock", ")", "b", ".", "getMask", "(", ")", ";", "if", "(", "slb", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "b", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "sourceCell", "=", "this", ".", "parentDiagram", ".", "getCell", "(", "slb", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", ")", ";", "}", "this", ".", "branches", "=", "new", "ArrayList", "<", "SLBranch", ">", "(", "10", ")", ";", "this", ".", "path", "=", "null", ";", "}", "public", "SLDiagram", "getDiagram", "(", ")", "{", "return", "this", ".", "parentDiagram", ";", "}", "public", "void", "describeBranches", "(", ")", "{", "if", "(", "!", "this", ".", "isVerbose", "(", ")", ")", "return", ";", "System", ".", "out", ".", "println", "(", ")", ";", "if", "(", "this", ".", "path", "==", "null", ")", "{", "if", "(", "this", ".", "branches", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'!\"", ")", ";", "return", ";", "}", "else", "{", "System", ".", "out", ".", "print", "(", "\"", "Signal", "'\"", "+", "getName", "(", ")", ")", ";", "if", "(", "this", ".", "branches", ".", "size", "(", ")", "<=", "1", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "sourceCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "sourceCell", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "this", ".", "sourceCell", ".", "getColIndex", "(", ")", "+", "\"]", "\"", ")", ";", "if", "(", "this", ".", "destCell", "!=", "null", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "destCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "destCell", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "this", ".", "destCell", ".", "getColIndex", "(", ")", "+", "\"]\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"'", "has", "\"", "+", "this", ".", "branches", ".", "size", "(", ")", "+", "\"\"", "+", "this", ".", "sourceCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "sourceCell", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "this", ".", "sourceCell", ".", "getColIndex", "(", ")", "+", "\"]", "\"", ")", ";", "}", "Iterator", "<", "SLBranch", ">", "ib", "=", "this", ".", "branches", ".", "iterator", "(", ")", ";", "while", "(", "ib", ".", "hasNext", "(", ")", ")", "{", "SLLineSegment", "ls", "=", "null", ";", "SLBranch", "list", "=", "ib", ".", "next", "(", ")", ";", "Iterator", "<", "SLLineSegment", ">", "iline", "=", "list", ".", "iterator", "(", ")", ";", "while", "(", "iline", ".", "hasNext", "(", ")", ")", "ls", "=", "iline", ".", "next", "(", ")", ";", "SLCell", "destination", "=", "ls", ".", "getDestCell", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "destination", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "destination", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "destination", ".", "getColIndex", "(", ")", "+", "\"]", "via\"", ")", ";", "iline", "=", "list", ".", "iterator", "(", ")", ";", "boolean", "first", "=", "true", ";", "while", "(", "iline", ".", "hasNext", "(", ")", ")", "{", "if", "(", "first", ")", "{", "first", "=", "false", ";", "System", ".", "out", ".", "print", "(", "\"", "\"", ")", ";", "}", "else", "System", ".", "out", ".", "print", "(", "\"", "then", "\"", ")", ";", "ls", "=", "iline", ".", "next", "(", ")", ";", "ls", ".", "describe", "(", ")", ";", "}", "}", "}", "}", "else", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "this", ".", "path", ".", "describe", "(", ")", ";", "}", "}", "public", "void", "describePath", "(", ")", "{", "if", "(", "!", "this", ".", "isVerbose", "(", ")", ")", "return", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "Signal", "'\"", "+", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "sourceCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "sourceCell", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "this", ".", "sourceCell", ".", "getColIndex", "(", ")", "+", "\"]", "\"", ")", ";", "if", "(", "path", "==", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "destCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"\"", "+", "this", ".", "destCell", ".", "getRowIndex", "(", ")", "+", "\",\"", "+", "this", ".", "destCell", ".", "getColIndex", "(", ")", "+", "\"].", "\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"", "to", "\"", "+", "this", ".", "getDests", "(", ")", ".", "size", "(", ")", "+", "\"\"", ")", ";", "this", ".", "path", ".", "describe", "(", "\"", "\"", ")", ";", "}", "}", "public", "void", "createAddLine", "(", "SLFileWriter", "writer", ")", "throws", "IOException", "{", "BlockArrayList", "dests", "=", "this", ".", "getDests", "(", ")", ";", "ArrayList", "<", "Integer", ">", "destPorts", "=", "this", ".", "getDestPortNumbers", "(", ")", ";", "Iterator", "<", "Block", ">", "id", "=", "dests", ".", "iterator", "(", ")", ";", "Iterator", "<", "Integer", ">", "ip", "=", "destPorts", ".", "iterator", "(", ")", ";", "while", "(", "id", ".", "hasNext", "(", ")", ")", "{", "Integer", "destPort", "=", "ip", ".", "next", "(", ")", ";", "Block", "destBlock", "=", "id", ".", "next", "(", ")", ";", "writer", ".", "addLine", "(", "this", ".", "getSource", "(", ")", ".", "getName", "(", ")", ",", "this", ".", "getSourcePort", "(", ")", ",", "destBlock", ".", "getName", "(", ")", ",", "destPort", ",", "this", ".", "getName", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
8,403
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "SLLineSegment", "{", "SLSignal", "parentSignal", ";", "boolean", "isHorizSeg", ";", "int", "[", "]", "coord", ";", "int", "trayOffset", ";", "SLCell", "destCell", ";", "SLLineSegment", "nextSeg", ";", "SLBranch", "branches", ";", "public", "SLLineSegment", "(", ")", "{", "parentSignal", "=", "null", ";", "isHorizSeg", "=", "false", ";", "coord", "=", "new", "int", "[", "5", "]", ";", "trayOffset", "=", "0", ";", "destCell", "=", "null", ";", "nextSeg", "=", "null", ";", "branches", "=", "new", "SLBranch", "(", "5", ")", ";", "}", "public", "SLLineSegment", "(", "SLSignal", "signal", ",", "int", "hTray", ",", "int", "start", ",", "int", "end", ")", "{", "this", "(", ")", ";", "isHorizSeg", "=", "true", ";", "parentSignal", "=", "signal", ";", "coord", "[", "0", "]", "=", "hTray", ";", "coord", "[", "1", "]", "=", "start", ";", "coord", "[", "2", "]", "=", "end", ";", "coord", "[", "3", "]", "=", "0", ";", "coord", "[", "4", "]", "=", "0", ";", "}", "public", "SLLineSegment", "(", "SLSignal", "signal", ",", "int", "vTray", ",", "int", "start", ",", "int", "end", ",", "int", "startPortNumber", ",", "int", "destPortNumber", ")", "{", "this", "(", ")", ";", "parentSignal", "=", "signal", ";", "coord", "[", "0", "]", "=", "vTray", ";", "coord", "[", "1", "]", "=", "start", ";", "coord", "[", "2", "]", "=", "end", ";", "coord", "[", "3", "]", "=", "startPortNumber", ";", "coord", "[", "4", "]", "=", "destPortNumber", ";", "}", "public", "boolean", "isHoriz", "(", ")", "{", "return", "isHorizSeg", ";", "}", "public", "boolean", "isVert", "(", ")", "{", "return", "!", "isHorizSeg", ";", "}", "public", "void", "setDestPort", "(", "int", "thePort", ")", "{", "coord", "[", "4", "]", "=", "thePort", ";", "}", "public", "void", "setDestCell", "(", "SLCell", "theDest", ")", "{", "this", ".", "destCell", "=", "theDest", ";", "}", "public", "void", "setNextSeg", "(", "SLLineSegment", "next", ")", "{", "this", ".", "nextSeg", "=", "next", ";", "}", "public", "void", "setTrayOffset", "(", ")", "{", "}", "private", "void", "setStart", "(", "int", "start", ")", "{", "coord", "[", "1", "]", "=", "start", ";", "}", "private", "void", "setSourcePort", "(", "int", "port", ")", "{", "coord", "[", "3", "]", "=", "port", ";", "}", "public", "int", "getTray", "(", ")", "{", "return", "coord", "[", "0", "]", ";", "}", "public", "int", "getTrayOffset", "(", ")", "{", "return", "trayOffset", ";", "}", "public", "int", "getStart", "(", ")", "{", "return", "coord", "[", "1", "]", ";", "}", "public", "int", "getEnd", "(", ")", "{", "return", "coord", "[", "2", "]", ";", "}", "public", "int", "getSourcePort", "(", ")", "{", "return", "coord", "[", "3", "]", ";", "}", "public", "int", "getDestPort", "(", ")", "{", "return", "coord", "[", "4", "]", ";", "}", "public", "ArrayList", "<", "SLLineSegment", ">", "getBranches", "(", ")", "{", "return", "branches", ";", "}", "public", "int", "numBranches", "(", ")", "{", "return", "branches", ".", "size", "(", ")", ";", "}", "public", "void", "addBranch", "(", "SLLineSegment", "newBranch", ")", "{", "this", ".", "branches", ".", "add", "(", "newBranch", ")", ";", "}", "public", "SLCell", "getDestCell", "(", ")", "{", "return", "this", ".", "destCell", ";", "}", "public", "void", "subtract", "(", "SLLineSegment", "predecessor", ")", "{", "if", "(", "(", "predecessor", ".", "isHoriz", "(", ")", "!=", "this", ".", "isHoriz", "(", ")", ")", "||", "(", "predecessor", ".", "getStart", "(", ")", "!=", "this", ".", "getStart", "(", ")", ")", "||", "(", "predecessor", ".", "getSourcePort", "(", ")", "!=", "this", ".", "getSourcePort", "(", ")", ")", "||", "(", "predecessor", ".", "getTray", "(", ")", "!=", "this", ".", "getTray", "(", ")", ")", "||", "(", "predecessor", ".", "getTrayOffset", "(", ")", "!=", "this", ".", "getTrayOffset", "(", ")", ")", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "else", "{", "if", "(", "parentSignal", ".", "isVerbose", "(", ")", ")", "this", ".", "describe", "(", "\"\"", ")", ";", "this", ".", "setStart", "(", "predecessor", ".", "getEnd", "(", ")", ")", ";", "this", ".", "setSourcePort", "(", "predecessor", ".", "getDestPort", "(", ")", ")", ";", "if", "(", "parentSignal", ".", "isVerbose", "(", ")", ")", "this", ".", "describe", "(", "\"\"", ")", ";", "}", "return", ";", "}", "public", "int", "calcLength", "(", ")", "{", "SLSignal", "sig", "=", "this", ".", "parentSignal", ";", "SLDiagram", "d", "=", "sig", ".", "getDiagram", "(", ")", ";", "int", "start", "=", "this", ".", "getStart", "(", ")", ";", "int", "end", "=", "this", ".", "getEnd", "(", ")", ";", "int", "p", "=", "this", ".", "getSourcePort", "(", ")", ";", "int", "q", "=", "this", ".", "getDestPort", "(", ")", ";", "int", "length", "=", "0", ";", "if", "(", "this", ".", "isVert", "(", ")", ")", "{", "int", "dir", "=", "1", ";", "if", "(", "end", "<", "start", ")", "dir", "=", "-", "1", ";", "if", "(", "end", "==", "start", ")", "{", "if", "(", "(", "p", "==", "0", ")", "&&", "(", "q", ">", "0", ")", ")", "dir", "=", "-", "1", ";", "if", "(", "(", "q", "==", "0", ")", "&&", "(", "p", ">", "0", ")", ")", "dir", "=", "1", ";", "if", "(", "(", "p", ">", "0", ")", "&&", "(", "q", ">", "0", ")", ")", "if", "(", "q", ">", "p", ")", "dir", "=", "-", "1", ";", "else", "dir", "=", "1", ";", "}", "for", "(", "int", "i", "=", "start", "+", "dir", ";", "i", "*", "dir", "<=", "dir", "*", "(", "end", "-", "dir", ")", ";", "i", "=", "i", "+", "dir", ")", "{", "length", "=", "length", "+", "(", "d", ".", "getRow", "(", "i", ")", ")", ".", "getSize", "(", ")", ";", "}", "if", "(", "(", "end", ">", "start", ")", "&&", "(", "q", "==", "0", ")", ")", "length", "=", "length", "+", "(", "d", ".", "getRow", "(", "end", ")", ")", ".", "getSize", "(", ")", ";", "boolean", "adjacent", "=", "(", "(", "end", "==", "start", ")", "&&", "(", "p", "!=", "0", ")", "&&", "(", "q", "!=", "0", ")", ")", ";", "if", "(", "!", "adjacent", ")", "{", "if", "(", "p", "!=", "0", ")", "{", "SLCell", "theCell", "=", "d", ".", "getCell", "(", "start", ",", "this", ".", "getTray", "(", ")", ")", ";", "if", "(", "theCell", "==", "null", ")", "theCell", "=", "d", ".", "getCell", "(", "start", ",", "this", ".", "getTray", "(", ")", "+", "1", ")", ";", "int", "offset", "=", "theCell", ".", "getHeight", "(", ")", "/", "2", ";", "length", "=", "length", "+", "offset", ";", "}", "else", "if", "(", "end", "!=", "start", ")", "length", "=", "length", "+", "(", "d", ".", "getRow", "(", "start", ")", ")", ".", "getSize", "(", ")", ";", "if", "(", "q", "!=", "0", ")", "{", "SLCell", "theCell", "=", "d", ".", "getCell", "(", "end", ",", "this", ".", "getTray", "(", ")", "+", "1", ")", ";", "if", "(", "theCell", "==", "null", ")", "theCell", "=", "d", ".", "getCell", "(", "end", ",", "this", ".", "getTray", "(", ")", ")", ";", "int", "offset", "=", "theCell", ".", "getHeight", "(", ")", "/", "2", ";", "length", "=", "length", "+", "offset", ";", "}", "else", "{", "}", "}", "length", "=", "dir", "*", "length", ";", "}", "else", "{", "for", "(", "int", "i", "=", "start", "+", "1", ";", "i", "<=", "(", "end", "-", "2", ")", ";", "i", "++", ")", "length", "=", "length", "+", "(", "d", ".", "getCol", "(", "i", ")", ")", ".", "getSize", "(", ")", ";", "length", "=", "length", "+", "(", "d", ".", "getCol", "(", "end", "-", "1", ")", ")", ".", "getSizeNoTray", "(", ")", ";", "SLRowColumnVector", "startCol", "=", "d", ".", "getCol", "(", "start", ")", ";", "SLCableTray", "startTray", "=", "startCol", ".", "getTray", "(", ")", ";", "int", "standoff", "=", "startTray", ".", "getStandoff", "(", "sig", ")", ";", "length", "=", "length", "-", "standoff", ";", "SLRowColumnVector", "endCol", "=", "d", ".", "getCol", "(", "end", "-", "1", ")", ";", "SLCableTray", "endTray", "=", "endCol", ".", "getTray", "(", ")", ";", "standoff", "=", "endTray", ".", "getStandoff", "(", "sig", ")", ";", "length", "=", "length", "+", "standoff", ";", "}", "return", "length", ";", "}", "public", "void", "describe", "(", ")", "{", "this", ".", "describe", "(", "\"\"", ")", ";", "}", "public", "void", "describe", "(", "String", "indent", ")", "{", "System", ".", "out", ".", "print", "(", "indent", ")", ";", "if", "(", "this", ".", "isHoriz", "(", ")", ")", "System", ".", "out", ".", "print", "(", "\"H:", "[\"", "+", "this", ".", "getTray", "(", ")", "+", "\"+\"", "+", "this", ".", "getTrayOffset", "(", ")", "+", "\",\"", "+", "this", ".", "getStart", "(", ")", "+", "\"]", "to", "[\"", "+", "this", ".", "getTray", "(", ")", "+", "\",\"", "+", "this", ".", "getEnd", "(", ")", "+", "\"]\"", ")", ";", "else", "System", ".", "out", ".", "print", "(", "\"V:", "[\"", "+", "this", ".", "getStart", "(", ")", "+", "\",\"", "+", "this", ".", "getTray", "(", ")", "+", "\"+\"", "+", "this", ".", "getTrayOffset", "(", ")", "+", "\",\"", "+", "this", ".", "getSourcePort", "(", ")", "+", "\"]", "to", "[\"", "+", "this", ".", "getEnd", "(", ")", "+", "\",\"", "+", "this", ".", "getTray", "(", ")", "+", "\"+\"", "+", "this", ".", "getTrayOffset", "(", ")", "+", "\",\"", "+", "this", ".", "getDestPort", "(", ")", "+", "\"]\"", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "(\"", ")", ";", "if", "(", "this", ".", "nextSeg", "!=", "null", ")", "System", ".", "out", ".", "print", "(", "\"S\"", ")", ";", "else", "System", ".", "out", ".", "print", "(", "\"", "\"", ")", ";", "if", "(", "this", ".", "branches", ".", "size", "(", ")", ">", "0", ")", "System", ".", "out", ".", "print", "(", "\"B\"", ")", ";", "else", "System", ".", "out", ".", "print", "(", "\"", "\"", ")", ";", "if", "(", "this", ".", "destCell", "!=", "null", ")", "System", ".", "out", ".", "print", "(", "\"D)\"", ")", ";", "else", "System", ".", "out", ".", "print", "(", "\"", ")\"", ")", ";", "if", "(", "this", ".", "destCell", "==", "null", ")", "if", "(", "this", ".", "nextSeg", "==", "null", ")", "if", "(", "this", ".", "branches", ".", "size", "(", ")", "==", "0", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "else", "{", "System", ".", "out", ".", "println", "(", "\",", "then", "\"", "+", "this", ".", "branches", ".", "size", "(", ")", "+", "\"", "branches:\"", ")", ";", "Iterator", "<", "SLLineSegment", ">", "it", "=", "this", ".", "branches", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "SLLineSegment", "ls", "=", "it", ".", "next", "(", ")", ";", "ls", ".", "describe", "(", "indent", "+", "\"", "\"", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\",", "then", "\"", ")", ";", "this", ".", "nextSeg", ".", "describe", "(", "indent", "+", "\"", "\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "print", "(", "\"", "to", "'\"", "+", "destCell", ".", "getBlock", "(", ")", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "if", "(", "this", ".", "nextSeg", "==", "null", ")", "if", "(", "this", ".", "branches", ".", "size", "(", ")", "==", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\".\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\",", "then", "\"", "+", "this", ".", "branches", ".", "size", "(", ")", "+", "\"", "branches:\"", ")", ";", "Iterator", "<", "SLLineSegment", ">", "it", "=", "this", ".", "branches", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "SLLineSegment", "ls", "=", "it", ".", "next", "(", ")", ";", "ls", ".", "describe", "(", "indent", "+", "\"", "\"", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\",", "then", "\"", ")", ";", "this", ".", "nextSeg", ".", "describe", "(", "indent", "+", "\"", "\"", ")", ";", "}", "}", "}", "public", "void", "createAddLine", "(", "SLFileWriter", "writer", ",", "String", "indent", ",", "boolean", "ptsEntered", ")", "throws", "IOException", "{", "boolean", "hasBranched", "=", "false", ";", "int", "length", "=", "this", ".", "calcLength", "(", ")", ";", "if", "(", "length", "!=", "0", ")", "{", "if", "(", "ptsEntered", ")", "writer", ".", "write", "(", "\";", "\"", ")", ";", "if", "(", "this", ".", "isHoriz", "(", ")", ")", "writer", ".", "write", "(", "this", ".", "calcLength", "(", ")", "+", "\",", "0\"", ")", ";", "else", "writer", ".", "write", "(", "\"0,", "\"", "+", "this", ".", "calcLength", "(", ")", ")", ";", "if", "(", "this", ".", "nextSeg", "!=", "null", ")", "{", "this", ".", "nextSeg", ".", "createAddLine", "(", "writer", ",", "indent", "+", "\"", "\"", ",", "true", ")", ";", "return", ";", "}", "}", "writer", ".", "writeln", "(", "\"]\"", ")", ";", "if", "(", "this", ".", "branches", ".", "size", "(", ")", "!=", "0", ")", "{", "hasBranched", "=", "true", ";", "Iterator", "<", "SLLineSegment", ">", "ib", "=", "this", ".", "branches", ".", "iterator", "(", ")", ";", "while", "(", "ib", ".", "hasNext", "(", ")", ")", "{", "SLLineSegment", "ls", "=", "ib", ".", "next", "(", ")", ";", "writer", ".", "writeln", "(", "indent", "+", "\"Branch", "{\"", ")", ";", "writer", ".", "write", "(", "indent", "+", "\"", "Points", "[\"", ")", ";", "ls", ".", "createAddLine", "(", "writer", ",", "indent", "+", "\"", "\"", ",", "false", ")", ";", "writer", ".", "writeln", "(", "indent", "+", "\"}\"", ")", ";", "}", "}", "if", "(", "this", ".", "destCell", "==", "null", ")", "if", "(", "!", "hasBranched", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "parentSignal", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "return", ";", "}", "else", "{", "if", "(", "hasBranched", ")", "writer", ".", "writeln", "(", "indent", "+", "\"Branch", "{\"", ")", ";", "SLBlock", "destBlock", "=", "destCell", ".", "getBlock", "(", ")", ";", "if", "(", "destBlock", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "parentSignal", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "int", "destPort", "=", "this", ".", "getDestPort", "(", ")", ";", "if", "(", "destPort", "==", "0", ")", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "parentSignal", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "writer", ".", "write", "(", "indent", ")", ";", "if", "(", "hasBranched", ")", "writer", ".", "write", "(", "\"", "\"", ")", ";", "writer", ".", "writeln", "(", "\"DstBlocktt\\\"\"", "+", "destBlock", ".", "getName", "(", ")", "+", "\"\\\"\"", ")", ";", "writer", ".", "write", "(", "indent", ")", ";", "if", "(", "hasBranched", ")", "writer", ".", "write", "(", "\"", "\"", ")", ";", "writer", ".", "writeln", "(", "\"DstPortttt\"", "+", "destPort", ")", ";", "if", "(", "hasBranched", ")", "writer", ".", "writeln", "(", "indent", "+", "\"}\"", ")", ";", "}", "}", "}", "</s>" ]
8,404
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "SLPathList", "extends", "ArrayList", "<", "SLBranch", ">", "{", "public", "SLPathList", "(", ")", "{", "super", "(", ")", ";", "}", "public", "SLPathList", "(", "int", "size", ")", "{", "super", "(", "size", ")", ";", "}", "public", "boolean", "add", "(", "SLBranch", "branch", ")", "{", "super", ".", "add", "(", "branch", ")", ";", "return", "true", ";", "}", "public", "void", "merge", "(", "SLPathList", "otherList", ")", "{", "Iterator", "<", "SLBranch", ">", "it", "=", "otherList", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "add", "(", "it", ".", "next", "(", ")", ")", ";", "}", "}", "public", "void", "describe", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "size", "(", ")", "+", "\"", "paths:\"", ")", ";", "int", "i", "=", "1", ";", "Iterator", "<", "SLBranch", ">", "it", "=", "this", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "Path", "\"", "+", "i", "+", "\":", "\"", ")", ";", "ArrayList", "<", "?", ">", "a", "=", "(", "ArrayList", "<", "?", ">", ")", "it", ".", "next", "(", ")", ";", "Iterator", "<", "?", ">", "ait", "=", "a", ".", "iterator", "(", ")", ";", "while", "(", "ait", ".", "hasNext", "(", ")", ")", "{", "SLLineSegment", "ls", "=", "(", "SLLineSegment", ")", "ait", ".", "next", "(", ")", ";", "ls", ".", "describe", "(", "\"", "\"", ")", ";", "}", "i", "++", ";", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}", "}", "</s>" ]
8,405
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "public", "class", "SLBranch", "extends", "ArrayList", "<", "SLLineSegment", ">", "{", "public", "SLBranch", "(", "int", "i", ")", "{", "super", "(", "i", ")", ";", "}", "private", "static", "final", "long", "serialVersionUID", "=", "-", "1954668026239970685L", ";", "}", "</s>" ]
8,406
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "</s>" ]
8,407
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "MatFileWriter", "extends", "FileWriter", "{", "int", "caseNumberCount", ";", "String", "modelName", ";", "SLDiagram", "diagram", ";", "ArrayList", "<", "String", ">", "missingOutputs", ";", "public", "MatFileWriter", "(", "SLDiagram", "diagram", ",", "String", "fileName", ")", "throws", "IOException", "{", "super", "(", "fileName", ")", ";", "this", ".", "diagram", "=", "diagram", ";", "this", ".", "caseNumberCount", "=", "0", ";", "}", "public", "void", "writeln", "(", "String", "cbuf", ")", "throws", "IOException", "{", "super", ".", "write", "(", "cbuf", "+", "\"n\"", ")", ";", "}", "public", "void", "writeDataHeader", "(", "String", "modelName", ")", "throws", "IOException", "{", "this", ".", "modelName", "=", "modelName", ";", "this", ".", "writeln", "(", "\"\"", "+", "this", ".", "modelName", "+", "\".mdl", "model\"", ")", ";", "this", ".", "writeln", "(", "\"clear", "\"", "+", "this", ".", "modelName", "+", "\"\"", ")", ";", "}", "public", "void", "writeDataFooter", "(", ")", "throws", "IOException", "{", "}", "public", "void", "writeVerifyScriptHeader", "(", "String", "modelName", ")", "{", "this", ".", "modelName", "=", "modelName", ";", "try", "{", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"_verify()\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", "+", "modelName", "+", "\"_setup\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "void", "writeVerifyScriptFooter", "(", ")", "{", "try", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"num_cases", "=", "\"", "+", "this", ".", "caseNumberCount", "+", "\";\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "this", ".", "modelName", "+", "\"');\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"outcome", "=", "0;\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "this", ".", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"", "else\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"", "end\"", ")", ";", "this", ".", "writeln", "(", "\"end\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "this", ".", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"else\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "this", ".", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"end\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "void", "writeCheckCaseFromStaticShot", "(", "StaticShot", "ss", ")", "{", "Iterator", "<", "VectorInfo", ">", "it", ";", "Iterator", "<", "String", ">", "nameit", ";", "boolean", "found", ";", "VectorInfo", "vi", "=", "null", ";", "VectorInfoArrayList", "inputs", "=", "ss", ".", "getInputs", "(", ")", ";", "VectorInfoArrayList", "outputs", "=", "ss", ".", "getOutputs", "(", ")", ";", "ArrayList", "<", "String", ">", "modelInputNames", "=", "this", ".", "diagram", ".", "getInputNames", "(", ")", ";", "ArrayList", "<", "String", ">", "modelOutputNames", "=", "this", ".", "diagram", ".", "getOutputNames", "(", ")", ";", "String", "caseName", "=", "ss", ".", "getName", "(", ")", ";", "try", "{", "this", ".", "caseNumberCount", "++", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%", "Checkcase", "\"", "+", "this", ".", "caseNumberCount", "+", "\"", "-", "\"", "+", "caseName", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"checkcase{\"", "+", "this", ".", "caseNumberCount", "+", "\"}.name", "=", "'\"", "+", "caseName", "+", "\"';\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"checkcase{\"", "+", "this", ".", "caseNumberCount", "+", "\"}.u", "=", "[\"", ")", ";", "nameit", "=", "modelInputNames", ".", "iterator", "(", ")", ";", "while", "(", "nameit", ".", "hasNext", "(", ")", ")", "{", "String", "name", "=", "nameit", ".", "next", "(", ")", ";", "found", "=", "false", ";", "it", "=", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "vi", "=", "it", ".", "next", "(", ")", ";", "String", "equivMDLname", "=", "MDLNameList", ".", "convertToMDLString", "(", "vi", ".", "getName", "(", ")", ")", ";", "if", "(", "name", ".", "equals", "(", "equivMDLname", ")", ")", "{", "found", "=", "true", ";", "this", ".", "writeln", "(", "vi", ".", "getValue", "(", ")", "+", "\"t%", "\"", "+", "vi", ".", "getName", "(", ")", ")", ";", "}", "}", "if", "(", "!", "found", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "name", "+", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "}", "}", "this", ".", "writeln", "(", "\"", "]';\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "nameit", "=", "modelOutputNames", ".", "iterator", "(", ")", ";", "VectorInfoArrayList", "outputInfo", "=", "new", "VectorInfoArrayList", "(", "modelOutputNames", ".", "size", "(", ")", ")", ";", "while", "(", "nameit", ".", "hasNext", "(", ")", ")", "{", "String", "name", "=", "nameit", ".", "next", "(", ")", ";", "found", "=", "false", ";", "it", "=", "outputs", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "vi", "=", "it", ".", "next", "(", ")", ";", "String", "equivMDLname", "=", "MDLNameList", ".", "convertToMDLString", "(", "vi", ".", "getName", "(", ")", ")", ";", "if", "(", "name", ".", "equals", "(", "equivMDLname", ")", ")", "{", "found", "=", "true", ";", "outputInfo", ".", "add", "(", "vi", ")", ";", "}", "}", "if", "(", "!", "found", ")", "{", "vi", "=", "new", "VectorInfo", "(", "name", ",", "\"\"", ",", "null", ",", "false", ")", ";", "vi", ".", "setTolerance", "(", "Double", ".", "POSITIVE_INFINITY", ")", ";", "outputInfo", ".", "add", "(", "vi", ")", ";", "if", "(", "this", ".", "missingOutputs", "==", "null", ")", "{", "this", ".", "missingOutputs", "=", "new", "ArrayList", "<", "String", ">", "(", "10", ")", ";", "}", "if", "(", "!", "this", ".", "missingOutputs", ".", "contains", "(", "name", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "name", "+", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "this", ".", "missingOutputs", ".", "add", "(", "name", ")", ";", "}", "}", "}", "this", ".", "writeln", "(", "\"checkcase{\"", "+", "this", ".", "caseNumberCount", "+", "\"}.y", "=", "[\"", ")", ";", "it", "=", "outputInfo", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "vi", "=", "it", ".", "next", "(", ")", ";", "if", "(", "vi", ".", "getTolerance", "(", ")", "!=", "Double", ".", "POSITIVE_INFINITY", ")", "{", "this", ".", "writeln", "(", "vi", ".", "getValue", "(", ")", "+", "\"t%", "\"", "+", "vi", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "this", ".", "writeln", "(", "0", "+", "\"t%", "\"", "+", "vi", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "}", "this", ".", "writeln", "(", "\"", "]';\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"checkcase{\"", "+", "this", ".", "caseNumberCount", "+", "\"}.tol", "=", "[\"", ")", ";", "it", "=", "outputInfo", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "vi", "=", "it", ".", "next", "(", ")", ";", "if", "(", "vi", ".", "getTolerance", "(", ")", "!=", "Double", ".", "POSITIVE_INFINITY", ")", "{", "this", ".", "writeln", "(", "vi", ".", "getTolerance", "(", ")", "+", "\"t%", "\"", "+", "vi", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "this", ".", "writeln", "(", "\"Inft%", "\"", "+", "vi", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "}", "this", ".", "writeln", "(", "\"", "]';\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "void", "writeMatrix", "(", "String", "arrayName", ",", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ")", "throws", "IOException", "{", "this", ".", "writeMatrix", "(", "arrayName", ",", "table", ",", "dims", ",", "0", ",", "\"\"", ")", ";", "}", "private", "int", "writeMatrix", "(", "String", "arrayName", ",", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ",", "int", "startIndex", ",", "String", "higherDims", ")", "throws", "IOException", "{", "int", "offset", ";", "int", "i", ",", "j", ";", "switch", "(", "dims", ".", "length", ")", "{", "case", "0", ":", "return", "0", ";", "case", "1", ":", "if", "(", "higherDims", ".", "length", "(", ")", "==", "0", ")", "this", ".", "write", "(", "arrayName", "+", "\"", "=", "[n\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "Double", "theValue", "=", "table", ".", "get", "(", "i", "+", "startIndex", ")", ";", "this", ".", "write", "(", "theValue", ".", "toString", "(", ")", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "this", ".", "write", "(", "\",", "\"", ")", ";", "}", "if", "(", "higherDims", ".", "length", "(", ")", "==", "0", ")", "this", ".", "write", "(", "\"];n\"", ")", ";", "return", "i", ";", "case", "2", ":", "if", "(", "higherDims", ".", "length", "(", ")", "==", "0", ")", "this", ".", "write", "(", "arrayName", "+", "\"", "=", "[n\"", ")", ";", "else", "this", ".", "write", "(", "arrayName", "+", "\"(:,:\"", "+", "higherDims", "+", "\"", "=", "[n\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "1", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "offset", "=", "writeMatrix", "(", "arrayName", ",", "table", ",", "newDims", ",", "startIndex", ",", "\"", "\"", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "this", ".", "write", "(", "\",n\"", ")", ";", "startIndex", "=", "startIndex", "+", "offset", ";", "}", "this", ".", "write", "(", "\"];n\"", ")", ";", "return", "startIndex", ";", "case", "3", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "2", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "newDims", "[", "1", "]", "=", "dims", "[", "2", "]", ";", "String", "hDims", "=", "new", "String", "(", "\",\"", "+", "(", "i", "+", "1", ")", "+", "higherDims", "+", "\")\"", ")", ";", "offset", "=", "writeMatrix", "(", "arrayName", ",", "table", ",", "newDims", ",", "startIndex", ",", "hDims", ")", ";", "startIndex", "=", "offset", ";", "}", "return", "startIndex", ";", "default", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "dims", ".", "length", "-", "1", "]", ";", "for", "(", "j", "=", "0", ";", "j", "<", "(", "dims", ".", "length", "-", "1", ")", ";", "j", "++", ")", "newDims", "[", "j", "]", "=", "dims", "[", "j", "+", "1", "]", ";", "String", "hDims", "=", "new", "String", "(", "\",\"", "+", "(", "i", "+", "1", ")", "+", "higherDims", ")", ";", "offset", "=", "writeMatrix", "(", "arrayName", ",", "table", ",", "newDims", ",", "startIndex", ",", "hDims", ")", ";", "startIndex", "=", "offset", ";", "}", "return", "startIndex", ";", "}", "}", "}", "</s>" ]
8,408
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Date", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "text", ".", "SimpleDateFormat", ";", "public", "class", "SLFileWriter", "extends", "FileWriter", "{", "int", "indent", ";", "SLDiagram", "diagram", ";", "String", "subsysName", ";", "int", "subsysHeight", ";", "int", "gridSpacing", "=", "5", ";", "int", "subsysTopLine", "=", "65", ";", "int", "greaterNumPortSpacing", "=", "30", ";", "int", "lesserNumPortSpacing", "=", "30", ";", "int", "greaterNumPortVertOffset", ";", "int", "lesserNumPortVertOffset", ";", "int", "subsysVertCL", "=", "300", ";", "int", "subsysWidth", "=", "180", ";", "int", "subsysPad", "=", "50", ";", "public", "SLFileWriter", "(", "SLDiagram", "theDiagram", ",", "String", "fileName", ")", "throws", "IOException", "{", "super", "(", "fileName", ")", ";", "this", ".", "diagram", "=", "theDiagram", ";", "this", ".", "indent", "=", "0", ";", "this", ".", "subsysName", "=", "\"unknown\"", ";", "}", "public", "void", "writeln", "(", "String", "cbuf", ")", "throws", "IOException", "{", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "this", ".", "indent", ";", "i", "++", ")", "super", ".", "write", "(", "\"", "\"", ")", ";", "super", ".", "write", "(", "cbuf", "+", "\"n\"", ")", ";", "}", "public", "void", "addBlock", "(", "String", "protoPath", ",", "String", "blockName", ",", "String", "paramString", ")", "throws", "IOException", "{", "String", "cmdline", "=", "\"add_block('\"", "+", "protoPath", "+", "\"','\"", "+", "this", ".", "subsysName", "+", "\"/\"", "+", "blockName", "+", "\"'\"", ";", "if", "(", "paramString", ".", "length", "(", ")", ">", "0", ")", "cmdline", "=", "cmdline", "+", "\",\"", "+", "paramString", ";", "cmdline", "=", "cmdline", "+", "\");\"", ";", "this", ".", "writeln", "(", "cmdline", ")", ";", "}", "public", "void", "addBuiltInBlock", "(", "String", "builtInType", ",", "String", "blockName", ",", "String", "paramString", ")", "throws", "IOException", "{", "String", "protoType", "=", "\"built-in/\"", "+", "builtInType", ";", "this", ".", "addBlock", "(", "protoType", ",", "blockName", ",", "paramString", ")", ";", "}", "public", "void", "setParam", "(", "String", "blockName", ",", "String", "paramName", ",", "String", "paramValue", ")", "throws", "IOException", "{", "this", ".", "writeln", "(", "\"set_param('\"", "+", "this", ".", "subsysName", "+", "\"/\"", "+", "blockName", "+", "\"','\"", "+", "paramName", "+", "\"',\"", "+", "paramValue", "+", "\");\"", ")", ";", "}", "public", "void", "addLine", "(", "String", "fromBlock", ",", "int", "fromPort", ",", "String", "toBlock", ",", "int", "toPort", ",", "String", "name", ")", "throws", "IOException", "{", "String", "cmdline", "=", "\"h=add_line('\"", "+", "this", ".", "subsysName", "+", "\"','\"", "+", "fromBlock", "+", "\"/\"", "+", "fromPort", "+", "\"','\"", "+", "toBlock", "+", "\"/\"", "+", "toPort", "+", "\"\"", ";", "this", ".", "writeln", "(", "cmdline", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "name", "+", "\"');\"", ")", ";", "}", "public", "void", "writeSLHeader", "(", "String", "modelName", ")", "throws", "IOException", "{", "int", "lesserNumPorts", ";", "int", "greaterNumPorts", ";", "int", "windowVertOffset", "=", "200", ";", "int", "windowHorzOffset", "=", "70", ";", "this", ".", "subsysName", "=", "modelName", "+", "\"/\"", "+", "modelName", ";", "if", "(", "this", ".", "diagram", ".", "getNumOutputs", "(", ")", ">", "this", ".", "diagram", ".", "getNumInputs", "(", ")", ")", "{", "greaterNumPorts", "=", "this", ".", "diagram", ".", "getNumOutputs", "(", ")", ";", "lesserNumPorts", "=", "this", ".", "diagram", ".", "getNumInputs", "(", ")", ";", "}", "else", "{", "greaterNumPorts", "=", "this", ".", "diagram", ".", "getNumInputs", "(", ")", ";", "lesserNumPorts", "=", "this", ".", "diagram", ".", "getNumOutputs", "(", ")", ";", "}", "subsysHeight", "=", "greaterNumPorts", "*", "greaterNumPortSpacing", ";", "int", "totalGreaterNumPortVertSpace", "=", "greaterNumPortSpacing", "*", "(", "greaterNumPorts", "-", "1", ")", ";", "this", ".", "greaterNumPortVertOffset", "=", "(", "subsysHeight", "-", "totalGreaterNumPortVertSpace", ")", "/", "2", ";", "lesserNumPortSpacing", "=", "this", ".", "gridSpacing", "*", "(", "int", ")", "(", "Math", ".", "floor", "(", "(", "this", ".", "subsysHeight", "/", "(", "(", "double", ")", "(", "lesserNumPorts", ")", "-", "0.5", ")", ")", "/", "(", "double", ")", "this", ".", "gridSpacing", ")", ")", ";", "int", "totalLesserNumPortVertSpace", "=", "lesserNumPortSpacing", "*", "(", "lesserNumPorts", "-", "1", ")", ";", "this", ".", "lesserNumPortVertOffset", "=", "(", "subsysHeight", "-", "totalLesserNumPortVertSpace", ")", "/", "2", ";", "int", "topOfBox", "=", "subsysTopLine", "-", "greaterNumPortVertOffset", ";", "int", "lesserNumPortFirstLineVertPos", "=", "topOfBox", "+", "this", ".", "lesserNumPortVertOffset", ";", "float", "gridPos", "=", "(", "float", ")", "lesserNumPortFirstLineVertPos", "/", "(", "float", ")", "this", ".", "gridSpacing", ";", "int", "intGridPos", "=", "Math", ".", "round", "(", "gridPos", ")", ";", "this", ".", "lesserNumPortVertOffset", "=", "intGridPos", "*", "this", ".", "gridSpacing", "-", "topOfBox", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "write", "(", "\"new_system('\"", "+", "modelName", "+", "\"'\"", ")", ";", "if", "(", "this", ".", "diagram", ".", "getLibFlag", "(", ")", ")", "{", "this", ".", "writeln", "(", "\",'Library');\"", ")", ";", "}", "else", "{", "this", ".", "writeln", "(", "\",'Model');\"", ")", ";", "}", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"');\"", ")", ";", "this", ".", "writeln", "(", "\"set_param('\"", "+", "modelName", "+", "\"\"", "+", "windowHorzOffset", "+", "\",", "\"", "+", "windowVertOffset", "+", "\",", "\"", "+", "(", "windowHorzOffset", "+", "2", "*", "subsysVertCL", ")", "+", "\",", "\"", "+", "(", "windowVertOffset", "+", "subsysHeight", "+", "2", "*", "subsysPad", ")", "+", "\"]);\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"end\"", ")", ";", "this", ".", "writeln", "(", "\"mws.clear;\"", ")", ";", "this", ".", "writeln", "(", "\"mws.evalin('\"", "+", "modelName", "+", "\"_data','\"", "+", "modelName", "+", "\"_setup');\"", ")", ";", "this", ".", "writeln", "(", "\"clear", "mws;\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "write", "(", "\"\"", "+", "this", ".", "subsysName", "+", "\"'\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "(", "subsysVertCL", "-", "subsysWidth", "/", "2", ")", "+", "\",", "\"", "+", "topOfBox", "+", "\",", "\"", "+", "(", "subsysVertCL", "+", "subsysWidth", "/", "2", ")", "+", "\",", "\"", "+", "(", "topOfBox", "+", "subsysHeight", ")", "+", "\"]);\"", ")", ";", "if", "(", "this", ".", "diagram", ".", "getEnabledFlag", "(", ")", ")", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "write", "(", "\"\"", "+", "this", ".", "subsysName", "+", "\"/Enable',\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "}", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "indent", "=", "4", ";", "}", "public", "void", "writeSLFooter", "(", "String", "version", ",", "String", "modelName", ")", "throws", "IOException", "{", "int", "count", ";", "int", "topOfPort", ";", "ArrayList", "<", "String", ">", "names", ";", "String", "name", ";", "Iterator", "<", "String", ">", "it", ";", "int", "vertSpace", ";", "int", "portWidth", "=", "30", ";", "int", "portHeight", "=", "14", ";", "int", "extraPad", "=", "40", ";", "int", "inportX", "=", "this", ".", "subsysVertCL", "-", "(", "this", ".", "subsysWidth", "/", "2", "+", "subsysPad", "+", "portWidth", "+", "extraPad", ")", ";", "int", "outportX", "=", "this", ".", "subsysVertCL", "+", "(", "this", ".", "subsysWidth", "/", "2", "+", "subsysPad", "+", "extraPad", ")", ";", "SimpleDateFormat", "timeStamp", "=", "new", "SimpleDateFormat", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "names", "=", "this", ".", "diagram", ".", "getOutputNames", "(", ")", ";", "it", "=", "names", ".", "iterator", "(", ")", ";", "count", "=", "0", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "count", "++", ";", "name", "=", "it", ".", "next", "(", ")", ";", "this", ".", "writeln", "(", "\"set_param('\"", "+", "this", ".", "subsysName", "+", "\"/\"", "+", "name", "+", "\"','Port','\"", "+", "count", "+", "\"');\"", ")", ";", "}", "this", ".", "indent", "=", "0", ";", "if", "(", "!", "this", ".", "diagram", ".", "getLibFlag", "(", ")", ")", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "if", "(", "this", ".", "diagram", ".", "getNumOutputs", "(", ")", "<", "this", ".", "diagram", ".", "getNumInputs", "(", ")", ")", "{", "vertSpace", "=", "this", ".", "greaterNumPortSpacing", ";", "topOfPort", "=", "subsysTopLine", "-", "portHeight", "/", "2", ";", "}", "else", "{", "vertSpace", "=", "this", ".", "lesserNumPortSpacing", ";", "topOfPort", "=", "subsysTopLine", "-", "portHeight", "/", "2", "+", "lesserNumPortVertOffset", "-", "greaterNumPortVertOffset", ";", "}", "count", "=", "0", ";", "names", "=", "this", ".", "diagram", ".", "getInputNames", "(", ")", ";", "it", "=", "names", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "count", "++", ";", "name", "=", "it", ".", "next", "(", ")", ";", "this", ".", "write", "(", "\"\"", "+", "modelName", "+", "\"/\"", "+", "name", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "inportX", "+", "\",", "\"", "+", "topOfPort", "+", "\",", "\"", "+", "(", "inportX", "+", "portWidth", ")", "+", "\",", "\"", "+", "(", "topOfPort", "+", "portHeight", ")", "+", "\"]);\"", ")", ";", "this", ".", "writeln", "(", "\"add_line('\"", "+", "modelName", "+", "\"','\"", "+", "name", "+", "\"/1','\"", "+", "modelName", "+", "\"/\"", "+", "count", "+", "\"');\"", ")", ";", "topOfPort", "=", "topOfPort", "+", "vertSpace", ";", "}", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "if", "(", "this", ".", "diagram", ".", "getNumOutputs", "(", ")", ">", "this", ".", "diagram", ".", "getNumInputs", "(", ")", ")", "{", "vertSpace", "=", "this", ".", "greaterNumPortSpacing", ";", "topOfPort", "=", "subsysTopLine", "-", "portHeight", "/", "2", ";", "}", "else", "{", "vertSpace", "=", "this", ".", "lesserNumPortSpacing", ";", "topOfPort", "=", "subsysTopLine", "-", "portHeight", "/", "2", "+", "lesserNumPortVertOffset", "-", "greaterNumPortVertOffset", ";", "}", "count", "=", "0", ";", "names", "=", "this", ".", "diagram", ".", "getOutputNames", "(", ")", ";", "it", "=", "names", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "count", "++", ";", "name", "=", "it", ".", "next", "(", ")", ";", "this", ".", "write", "(", "\"\"", "+", "modelName", "+", "\"/\"", "+", "name", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "outportX", "+", "\",", "\"", "+", "topOfPort", "+", "\",", "\"", "+", "(", "outportX", "+", "portWidth", ")", "+", "\",", "\"", "+", "(", "topOfPort", "+", "portHeight", ")", "+", "\"]);\"", ")", ";", "this", ".", "writeln", "(", "\"add_line('\"", "+", "modelName", "+", "\"','\"", "+", "modelName", "+", "\"/\"", "+", "count", "+", "\"','\"", "+", "name", "+", "\"/1');\"", ")", ";", "topOfPort", "=", "topOfPort", "+", "vertSpace", ";", "}", "}", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", "+", "version", "+", "\"\"", "+", "subsysVertCL", "+", "\",", "22]);\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"if", "exist('\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"", "if", "\"", "+", "modelName", "+", "\"_verify\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"','\"", "+", "modelName", "+", "\"');\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"", "else\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"", "end\"", ")", ";", "this", ".", "writeln", "(", "\"else\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"','\"", "+", "modelName", "+", "\"');\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"end\"", ")", ";", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"%", "\"", "+", "modelName", "+", "\"\"", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "version", ")", ";", "this", ".", "writeln", "(", "\"%", "on", "\"", "+", "timeStamp", ".", "format", "(", "new", "Date", "(", ")", ")", "+", "\".\"", ")", ";", "}", "}", "</s>" ]
8,409
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2sl", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "DAVE2SL", "extends", "DAVE", "{", "String", "mdlFileName", ";", "String", "matFileName", ";", "SLDiagram", "myDiagram", ";", "boolean", "warnRunTimeFlag", ";", "boolean", "makeLib", ";", "boolean", "makeEnabledSubSys", ";", "public", "DAVE2SL", "(", ")", "{", "super", "(", ")", ";", "this", ".", "warnRunTimeFlag", "=", "false", ";", "this", ".", "makeLib", "=", "false", ";", "this", ".", "makeEnabledSubSys", "=", "false", ";", "}", "public", "DAVE2SL", "(", "String", "[", "]", "args", ")", "{", "this", "(", ")", ";", "this", ".", "parseOptions", "(", "args", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "this", ".", "getModel", "(", ")", ".", "makeVerbose", "(", ")", ";", "}", "}", "public", "boolean", "makeLib", "(", ")", "{", "return", "this", ".", "makeLib", ";", "}", "@", "Override", "public", "void", "setInputFileName", "(", "String", "fn", ")", "{", "super", ".", "setInputFileName", "(", "fn", ")", ";", "this", ".", "mdlFileName", "=", "this", ".", "getStubName", "(", ")", "+", "\"_create.m\"", ";", "this", ".", "matFileName", "=", "this", ".", "getStubName", "(", ")", "+", "\"_setup.m\"", ";", "}", "private", "void", "parseOptions", "(", "String", "inArgs", "[", "]", ")", "{", "String", "exampleUse", "=", "\"\"", ";", "int", "numArgs", "=", "inArgs", ".", "length", ";", "this", ".", "setArgs", "(", "inArgs", ")", ";", "if", "(", "numArgs", ">", "0", ")", "{", "int", "parsedArgs", "=", "0", ";", "if", "(", "this", ".", "matchOptionArgs", "(", "\"c\"", ",", "\"count\"", ")", ")", "{", "this", ".", "setGenStatsFlag", "(", ")", ";", "parsedArgs", "++", ";", "}", "if", "(", "this", ".", "matchOptionArgs", "(", "\"d\"", ",", "\"debug\"", ")", ")", "{", "this", ".", "makeVerbose", "(", ")", ";", "parsedArgs", "++", ";", "}", "if", "(", "this", ".", "matchOptionArgs", "(", "\"w\"", ",", "\"warnruntime\"", ")", ")", "{", "this", ".", "warnRunTimeFlag", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "this", ".", "matchOptionArgs", "(", "\"l\"", ",", "\"lib\"", ")", ")", "{", "this", ".", "makeLib", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "this", ".", "matchOptionArgs", "(", "\"e\"", ",", "\"enabled\"", ")", ")", "{", "this", ".", "makeEnabledSubSys", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"v\"", ",", "\"version\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "getVersion", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "parsedArgs", "<", "(", "numArgs", "-", "1", ")", ")", "{", "if", "(", "numArgs", "==", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "getArgs", "(", ")", "[", "2", "]", "+", "\"'.\"", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "numArgs", "-", "1", ")", "+", "\"\"", ")", ";", "}", "System", ".", "err", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "setInputFileName", "(", "inArgs", "[", "numArgs", "-", "1", "]", ")", ";", "}", "public", "void", "createModel", "(", ")", "throws", "IOException", "{", "this", ".", "myDiagram", "=", "new", "SLDiagram", "(", "this", ".", "getModel", "(", ")", ")", ";", "if", "(", "this", ".", "warnRunTimeFlag", ")", "{", "this", ".", "myDiagram", ".", "setWarnOnClip", "(", ")", ";", "}", "if", "(", "this", ".", "makeLib", ")", "{", "this", ".", "myDiagram", ".", "setLibFlag", "(", ")", ";", "}", "if", "(", "this", ".", "makeEnabledSubSys", ")", "{", "this", ".", "myDiagram", ".", "setEnabledFlag", "(", ")", ";", "}", "File", "file", "=", "new", "File", "(", "this", ".", "getStubName", "(", ")", ")", ";", "String", "modelName", "=", "file", ".", "getName", "(", ")", ";", "SLFileWriter", "mdlWriter", "=", "new", "SLFileWriter", "(", "this", ".", "myDiagram", ",", "this", ".", "mdlFileName", ")", ";", "MatFileWriter", "matWriter", "=", "new", "MatFileWriter", "(", "this", ".", "myDiagram", ",", "this", ".", "matFileName", ")", ";", "mdlWriter", ".", "writeSLHeader", "(", "modelName", ")", ";", "matWriter", ".", "writeDataHeader", "(", "modelName", ")", ";", "this", ".", "myDiagram", ".", "createModel", "(", "mdlWriter", ",", "matWriter", ")", ";", "mdlWriter", ".", "writeSLFooter", "(", "this", ".", "getVersion", "(", ")", ",", "modelName", ")", ";", "matWriter", ".", "writeDataFooter", "(", ")", ";", "mdlWriter", ".", "close", "(", ")", ";", "matWriter", ".", "close", "(", ")", ";", "}", "public", "void", "createVerifyScript", "(", ")", "{", "MatFileWriter", "scriptWriter", ";", "String", "modelName", "=", "this", ".", "getModel", "(", ")", ".", "getName", "(", ")", ";", "String", "scriptFileName", "=", "modelName", "+", "\"_verify.m\"", ";", "try", "{", "scriptWriter", "=", "new", "MatFileWriter", "(", "this", ".", "myDiagram", ",", "scriptFileName", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "return", ";", "}", "scriptWriter", ".", "writeVerifyScriptHeader", "(", "modelName", ")", ";", "CheckData", "cd", "=", "this", ".", "getCheckcaseData", "(", ")", ";", "ArrayList", "<", "StaticShot", ">", "al", "=", "cd", ".", "getStaticShots", "(", ")", ";", "Iterator", "<", "StaticShot", ">", "it", "=", "al", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "StaticShot", "ss", "=", "it", ".", "next", "(", ")", ";", "scriptWriter", ".", "writeCheckCaseFromStaticShot", "(", "ss", ")", ";", "}", "scriptWriter", ".", "writeVerifyScriptFooter", "(", ")", ";", "try", "{", "scriptWriter", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "boolean", "success", "=", "false", ";", "DAVE2SL", "dave2sl", "=", "new", "DAVE2SL", "(", "args", ")", ";", "try", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "success", "=", "dave2sl", ".", "parseFile", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "!", "success", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "try", "{", "if", "(", "dave2sl", ".", "hasCheckcases", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "if", "(", "!", "dave2sl", ".", "verify", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "}", "}", "catch", "(", "NoSuchMethodError", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "try", "{", "if", "(", "dave2sl", ".", "getGenStatsFlag", "(", ")", ")", "{", "dave2sl", ".", "reportStats", "(", ")", ";", "}", "}", "catch", "(", "NoSuchMethodError", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "try", "{", "dave2sl", ".", "createModel", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", ";", "}", "if", "(", "dave2sl", ".", "makeLib", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "if", "(", "dave2sl", ".", "hasCheckcases", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "dave2sl", ".", "createVerifyScript", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", "+", "dave2sl", ".", "getStubName", "(", ")", "+", "\".\"", ")", ";", "}", "}", "</s>" ]
8,410
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "FuncTableTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "Element", "_gtd", ";", "protected", "FuncTable", "_gft", ";", "protected", "BreakpointSet", "_bpAlpha1", ";", "protected", "BreakpointSet", "_bpDe1", ";", "protected", "final", "Double", "EPS", "=", "0.0000001", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_bpAlpha1", "=", "BreakpointSetTest", ".", "generateSampleAlphaBreakpointSet", "(", "_model", ")", ";", "_bpDe1", "=", "BreakpointSetTest", ".", "generateSampleElevBreakpointSet", "(", "_model", ")", ";", "_gtd", "=", "generateSampleGriddedTableDefDOM", "(", ")", ";", "_gft", "=", "new", "FuncTable", "(", "_gtd", ",", "_model", ")", ";", "}", "public", "void", "testFuncTableModel", "(", ")", "{", "FuncTable", "ft", "=", "new", "FuncTable", "(", "_model", ")", ";", "assertNotNull", "(", "ft", ")", ";", "assertEquals", "(", "0", ",", "ft", ".", "numDim", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "ft", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "ft", ".", "size", "(", ")", ")", ";", "}", "public", "void", "testFuncTableStringElementModel", "(", ")", "{", "FuncTable", "ft", "=", "null", ";", "assertNotNull", "(", "_gtd", ")", ";", "try", "{", "ft", "=", "new", "FuncTable", "(", "\"newID\"", ",", "_gtd", ",", "_model", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertNotNull", "(", "ft", ")", ";", "assertEquals", "(", "\"newID\"", ",", "ft", ".", "getGTID", "(", ")", ")", ";", "}", "public", "void", "testFuncTableElementModel", "(", ")", "{", "assertNotNull", "(", "_gft", ")", ";", "}", "public", "void", "testFuncTableStringStringStringStringIntModel", "(", ")", "{", "FuncTable", "ft", "=", "new", "FuncTable", "(", "\"simpleFT\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", ",", "1", ",", "_model", ")", ";", "assertNotNull", "(", "ft", ")", ";", "assertEquals", "(", "\"simpleFT\"", ",", "ft", ".", "getGTID", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "ft", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "ft", ".", "getDescription", "(", ")", ")", ";", "assertEquals", "(", "6", ",", "ft", ".", "size", "(", ")", ")", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "ft", ".", "printTable", "(", "new", "PrintWriter", "(", "writer", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testRegister", "(", ")", "{", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_gft", ".", "isVerbose", "(", ")", ")", ";", "_gft", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_gft", ".", "isVerbose", "(", ")", ")", ";", "_gft", ".", "silence", "(", ")", ";", "assertFalse", "(", "_gft", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testAddBPID", "(", ")", "{", "_gft", ".", "addBPID", "(", "3", ",", "\"newBP\"", ")", ";", "assertEquals", "(", "\"newBP\"", ",", "_gft", ".", "getBPID", "(", "3", ")", ")", ";", "}", "public", "void", "testGetBPIterator", "(", ")", "{", "Iterator", "<", "String", ">", "bpit", "=", "_gft", ".", "getBPIterator", "(", ")", ";", "assertNotNull", "(", "bpit", ")", ";", "assertTrue", "(", "bpit", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "\"DE1\"", ",", "bpit", ".", "next", "(", ")", ")", ";", "assertTrue", "(", "bpit", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "\"ALPHA1\"", ",", "bpit", ".", "next", "(", ")", ")", ";", "assertFalse", "(", "bpit", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetBPID", "(", ")", "{", "assertEquals", "(", "\"DE1\"", ",", "_gft", ".", "getBPID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"ALPHA1\"", ",", "_gft", ".", "getBPID", "(", "2", ")", ")", ";", "try", "{", "assertEquals", "(", "\"\"", ",", "_gft", ".", "getBPID", "(", "3", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "}", "}", "public", "void", "testGetName", "(", ")", "{", "assertEquals", "(", "\"Cm0_table\"", ",", "_gft", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetGTID", "(", ")", "{", "assertEquals", "(", "\"CMT_TABLE\"", ",", "_gft", ".", "getGTID", "(", ")", ")", ";", "}", "public", "void", "testSize", "(", ")", "{", "assertEquals", "(", "60", ",", "_gft", ".", "size", "(", ")", ")", ";", "}", "public", "void", "testNumDim", "(", ")", "{", "assertEquals", "(", "2", ",", "_gft", ".", "numDim", "(", ")", ")", ";", "}", "public", "void", "testDim", "(", ")", "{", "assertEquals", "(", "5", ",", "_gft", ".", "dim", "(", "0", ")", ")", ";", "assertEquals", "(", "12", ",", "_gft", ".", "dim", "(", "1", ")", ")", ";", "}", "public", "void", "testGetDimensions", "(", ")", "{", "int", "[", "]", "dims", "=", "_gft", ".", "getDimensions", "(", ")", ";", "assertNotNull", "(", "dims", ")", ";", "assertEquals", "(", "2", ",", "dims", ".", "length", ")", ";", "assertEquals", "(", "5", ",", "dims", "[", "0", "]", ")", ";", "assertEquals", "(", "12", ",", "dims", "[", "1", "]", ")", ";", "}", "public", "void", "testGetValues", "(", ")", "{", "ArrayList", "<", "Double", ">", "vals", "=", "_gft", ".", "getValues", "(", ")", ";", "assertNotNull", "(", "vals", ")", ";", "assertEquals", "(", "60", ",", "vals", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "0.205", ",", "vals", ".", "get", "(", "0", ")", ",", "EPS", ")", ";", "assertEquals", "(", "0.192", ",", "vals", ".", "get", "(", "11", ")", ",", "EPS", ")", ";", "assertEquals", "(", "0.010", ",", "vals", ".", "get", "(", "29", ")", ",", "EPS", ")", ";", "assertEquals", "(", "-", "0.259", ",", "vals", ".", "get", "(", "48", ")", ",", "EPS", ")", ";", "assertEquals", "(", "-", "0.005", ",", "vals", ".", "get", "(", "59", ")", ",", "EPS", ")", ";", "try", "{", "vals", ".", "get", "(", "-", "1", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "}", "try", "{", "vals", ".", "get", "(", "60", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "IndexOutOfBoundsException", "e", ")", "{", "}", "}", "public", "void", "testPrintTableWriter", "(", ")", "{", "int", "expectedLines", "=", "5", ";", "int", "expectedLength", "=", "873", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "StringBuffer", "buffer", ";", "String", "osName", "=", "System", ".", "getProperty", "(", "\"os.name\"", ")", ";", "assertNotNull", "(", "writer", ")", ";", "try", "{", "_gft", ".", "printTable", "(", "writer", ")", ";", "buffer", "=", "writer", ".", "getBuffer", "(", ")", ";", "if", "(", "osName", ".", "contains", "(", "\"Windows\"", ")", ")", "{", "expectedLength", "+=", "expectedLines", ";", "}", "assertEquals", "(", "expectedLength", ",", "buffer", ".", "length", "(", ")", ")", ";", "String", "[", "]", "lines", "=", "buffer", ".", "toString", "(", ")", ".", "split", "(", "System", ".", "getProperty", "(", "\"\"", ")", ")", ";", "assertEquals", "(", "expectedLines", ",", "lines", ".", "length", ")", ";", "assertNotNull", "(", "lines", "[", "0", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "0", "]", ")", ";", "assertNotNull", "(", "lines", "[", "1", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "1", "]", ")", ";", "assertNotNull", "(", "lines", "[", "2", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "2", "]", ")", ";", "assertNotNull", "(", "lines", "[", "3", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "3", "]", ")", ";", "assertNotNull", "(", "lines", "[", "4", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "4", "]", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testGetPt", "(", ")", "{", "boolean", "dontExpectException", "=", "false", ";", "checkPt", "(", "0", ",", "0", ",", "0.205", ",", "dontExpectException", ")", ";", "checkPt", "(", "0", ",", "11", ",", "0.192", ",", "dontExpectException", ")", ";", "checkPt", "(", "2", ",", "5", ",", "0.010", ",", "dontExpectException", ")", ";", "checkPt", "(", "4", ",", "0", ",", "-", "0.259", ",", "dontExpectException", ")", ";", "checkPt", "(", "4", ",", "11", ",", "-", "0.005", ",", "dontExpectException", ")", ";", "boolean", "expectException", "=", "true", ";", "checkPt", "(", "-", "1", ",", "-", "1", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "-", "1", ",", "0", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "-", "1", ",", "11", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "0", ",", "-", "1", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "4", ",", "12", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "5", ",", "11", ",", "0", ",", "expectException", ")", ";", "checkPt", "(", "5", ",", "12", ",", "0", ",", "expectException", ")", ";", "}", "protected", "void", "checkPt", "(", "int", "index1", ",", "int", "index2", ",", "double", "expectedValue", ",", "boolean", "expectException", ")", "{", "double", "point", "=", "Double", ".", "NaN", ";", "int", "[", "]", "indices", "=", "new", "int", "[", "2", "]", ";", "indices", "[", "0", "]", "=", "index1", ";", "indices", "[", "1", "]", "=", "index2", ";", "try", "{", "point", "=", "_gft", ".", "getPt", "(", "indices", ")", ";", "if", "(", "expectException", ")", "{", "fail", "(", "\"\"", "+", "index1", "+", "\",", "\"", "+", "index2", "+", "\"]\"", ")", ";", "}", "else", "{", "assertEquals", "(", "expectedValue", ",", "point", ",", "EPS", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "expectException", ")", "{", "}", "else", "{", "fail", "(", "\"\"", "+", "index1", "+", "\",", "\"", "+", "index2", "+", "\"]", ":\"", ")", ";", "}", "}", "}", "public", "static", "Element", "generateSampleGriddedTableDefDOM", "(", ")", "{", "Element", "dataTableElement", "=", "new", "Element", "(", "\"dataTable\"", ")", ";", "dataTableElement", ".", "addContent", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", ";", "Element", "bpRef1", "=", "new", "Element", "(", "\"bpRef\"", ")", ";", "bpRef1", ".", "setAttribute", "(", "\"bpID\"", ",", "\"DE1\"", ")", ";", "Element", "bpRef2", "=", "new", "Element", "(", "\"bpRef\"", ")", ";", "bpRef2", ".", "setAttribute", "(", "\"bpID\"", ",", "\"ALPHA1\"", ")", ";", "Element", "breakpointRefs", "=", "new", "Element", "(", "\"\"", ")", ";", "breakpointRefs", ".", "addContent", "(", "bpRef1", ")", ";", "breakpointRefs", ".", "addContent", "(", "bpRef2", ")", ";", "Element", "gtd", "=", "new", "Element", "(", "\"\"", ")", ";", "gtd", ".", "setAttribute", "(", "\"name\"", ",", "\"Cm0_table\"", ")", ";", "gtd", ".", "setAttribute", "(", "\"gtID\"", ",", "\"CMT_TABLE\"", ")", ";", "gtd", ".", "addContent", "(", "breakpointRefs", ")", ";", "gtd", ".", "addContent", "(", "dataTableElement", ")", ";", "return", "gtd", ";", "}", "}", "</s>" ]
8,411
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathMinusTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "Signal", "_minusAlpha", ";", "protected", "Signal", "_alphaMinusBeta", ";", "protected", "Signal", "_alphaSignal", ";", "protected", "Signal", "_betaSignal", ";", "protected", "BlockMathMinus", "_unaryMinusBlock", ";", "protected", "BlockMathMinus", "_binaryMinusBlock", ";", "protected", "BlockMathConstant", "_constantBetaBlock", ";", "protected", "BlockMathConstant", "_constantAlphaBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "{", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_minusAlpha", "=", "new", "Signal", "(", "\"minusAlpha\"", ",", "\"minusAlpha\"", ",", "\"deg\"", ",", "4", ",", "_model", ")", ";", "Element", "alphaEl", "=", "new", "Element", "(", "\"ci\"", ")", ";", "alphaEl", ".", "addContent", "(", "\"alpha\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "new", "Element", "(", "\"minus\"", ")", ")", ";", "applyElement", ".", "addContent", "(", "alphaEl", ")", ";", "_unaryMinusBlock", "=", "new", "BlockMathMinus", "(", "applyElement", ",", "_model", ")", ";", "_unaryMinusBlock", ".", "addConstInput", "(", "\"-3.45\"", ",", "1", ")", ";", "_alphaSignal", "=", "_unaryMinusBlock", ".", "getInput", "(", "0", ")", ";", "_constantAlphaBlock", "=", "(", "BlockMathConstant", ")", "_alphaSignal", ".", "getSource", "(", ")", ";", "try", "{", "_unaryMinusBlock", ".", "addOutput", "(", "_minusAlpha", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "_alphaMinusBeta", "=", "new", "Signal", "(", "\"\"", ",", "\"\"", ",", "\"deg\"", ",", "4", ",", "_model", ")", ";", "Element", "betaEl", "=", "new", "Element", "(", "\"ci\"", ")", ";", "betaEl", ".", "addContent", "(", "\"beta\"", ")", ";", "applyElement", ".", "addContent", "(", "betaEl", ")", ";", "_binaryMinusBlock", "=", "new", "BlockMathMinus", "(", "applyElement", ",", "_model", ")", ";", "_alphaSignal", ".", "addSink", "(", "_binaryMinusBlock", ",", "1", ")", ";", "_binaryMinusBlock", ".", "addConstInput", "(", "\"+3.45\"", ",", "2", ")", ";", "_betaSignal", "=", "_binaryMinusBlock", ".", "getInput", "(", "1", ")", ";", "_constantBetaBlock", "=", "(", "BlockMathConstant", ")", "_betaSignal", ".", "getSource", "(", ")", ";", "try", "{", "_binaryMinusBlock", ".", "addOutput", "(", "_alphaMinusBeta", ")", ";", "}", "catch", "(", "DAVEException", "e2", ")", "{", "fail", "(", "\"\"", "+", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "_model", ".", "wireBlocks", "(", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e3", ")", "{", "fail", "(", "\"\"", "+", "e3", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result1", "=", "_unaryMinusBlock", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"minusAlpha\"", ",", "result1", ".", "getVarName", "(", "0", ")", ")", ";", "CodeAndVarNames", "result2", "=", "_binaryMinusBlock", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result2", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "result2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result1", "=", "_unaryMinusBlock", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"minusAlpha\"", ",", "result1", ".", "getVarName", "(", "0", ")", ")", ";", "CodeAndVarNames", "result2", "=", "_binaryMinusBlock", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result2", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "result2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "{", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "_unaryMinusBlock", ".", "describeSelf", "(", "writer", ")", ";", "}", "catch", "(", "IOException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "writer", ".", "toString", "(", ")", ")", ";", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "_binaryMinusBlock", ".", "describeSelf", "(", "writer", ")", ";", "}", "catch", "(", "IOException", "e2", ")", "{", "fail", "(", "\"\"", "+", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "assertEquals", "(", "3.45", ",", "_unaryMinusBlock", ".", "getValue", "(", ")", ",", "0.000001", ")", ";", "assertEquals", "(", "-", "6.90", ",", "_binaryMinusBlock", ".", "getValue", "(", ")", ",", "0.000001", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "_unaryMinusBlock", ".", "isReady", "(", ")", ")", ";", "assertTrue", "(", "_binaryMinusBlock", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_unaryMinusBlock", ".", "allInputsReady", "(", ")", ")", ";", "assertTrue", "(", "_binaryMinusBlock", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_unaryMinusBlock", ".", "isVerbose", "(", ")", ")", ";", "_unaryMinusBlock", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_unaryMinusBlock", ".", "isVerbose", "(", ")", ")", ";", "_unaryMinusBlock", ".", "silence", "(", ")", ";", "assertFalse", "(", "_unaryMinusBlock", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetModels", "(", ")", "{", "assertEquals", "(", "_model", ".", "getName", "(", ")", ",", "_unaryMinusBlock", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "_model", ".", "getName", "(", ")", ",", "_binaryMinusBlock", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetSetName", "(", ")", "{", "assertEquals", "(", "\"minus_1\"", ",", "_unaryMinusBlock", ".", "getName", "(", ")", ")", ";", "_unaryMinusBlock", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "_unaryMinusBlock", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"minus\"", ",", "_unaryMinusBlock", ".", "getType", "(", ")", ")", ";", "assertEquals", "(", "\"minus\"", ",", "_binaryMinusBlock", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarID", "(", ")", "{", "assertEquals", "(", "\"alpha\"", ",", "_unaryMinusBlock", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "_binaryMinusBlock", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "_binaryMinusBlock", ".", "getVarID", "(", "2", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "Iterator", "<", "String", ">", "it", ";", "String", "s", ";", "it", "=", "_unaryMinusBlock", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "it", "=", "_binaryMinusBlock", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "s", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"beta\"", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutput", "(", ")", "{", "Signal", "s", ";", "s", "=", "_unaryMinusBlock", ".", "getOutput", "(", ")", ";", "assertEquals", "(", "_minusAlpha", ",", "s", ")", ";", "s", "=", "_binaryMinusBlock", ".", "getOutput", "(", ")", ";", "assertEquals", "(", "_alphaMinusBeta", ",", "s", ")", ";", "}", "public", "void", "getGetInputIterator", "(", ")", "{", "Iterator", "<", "Signal", ">", "it", ";", "Signal", "s", ";", "it", "=", "_unaryMinusBlock", ".", "getInputIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_alphaSignal", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "it", "=", "_binaryMinusBlock", ".", "getInputIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_alphaSignal", ",", "s", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_betaSignal", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"minusAlpha\"", ",", "_unaryMinusBlock", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "_binaryMinusBlock", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "1", ",", "_unaryMinusBlock", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "_binaryMinusBlock", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "1", ",", "_unaryMinusBlock", ".", "numVarIDs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "_binaryMinusBlock", ".", "numVarIDs", "(", ")", ")", ";", "}", "}", "</s>" ]
8,412
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathProductTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "Signal", "_outputSignal", ";", "protected", "Signal", "_value1Signal", ";", "protected", "Signal", "_value2Signal", ";", "protected", "String", "_value1SignalID", ";", "protected", "String", "_value2SignalID", ";", "protected", "BlockMathConstant", "_value1Block", ";", "protected", "BlockMathConstant", "_value2Block", ";", "protected", "BlockMathProduct", "_block", ";", "private", "StringWriter", "_writer", ";", "private", "final", "double", "EPS", "=", "0.000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "String", "routineName", "=", "\"\"", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_value1Block", "=", "new", "BlockMathConstant", "(", "\"-3.5\"", ",", "_model", ")", ";", "_value2Block", "=", "new", "BlockMathConstant", "(", "\"", "2.0\"", ",", "_model", ")", ";", "_value1SignalID", "=", "\"PB\"", ";", "_value2SignalID", "=", "\"BSPAN\"", ";", "_value1Signal", "=", "new", "Signal", "(", "\"PB\"", ",", "_value1SignalID", ",", "\"d_s\"", ",", "1", ",", "_model", ")", ";", "_value2Signal", "=", "new", "Signal", "(", "\"BSPAN\"", ",", "_value2SignalID", ",", "\"ft\"", ",", "1", ",", "_model", ")", ";", "_value1Block", ".", "addOutput", "(", "_value1Signal", ")", ";", "_value2Block", ".", "addOutput", "(", "_value2Signal", ")", ";", "_outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "_model", ")", ";", "Element", "theValue1", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue1", ".", "addContent", "(", "\"PB\"", ")", ";", "Element", "theValue2", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue2", ".", "addContent", "(", "\"BSPAN\"", ")", ";", "Element", "theTimesElement", "=", "new", "Element", "(", "\"times\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "theTimesElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue1", ")", ";", "applyElement", ".", "addContent", "(", "theValue2", ")", ";", "_block", "=", "new", "BlockMathProduct", "(", "applyElement", ",", "_model", ")", ";", "_block", ".", "addInput", "(", "_value1Signal", ",", "1", ")", ";", "_block", ".", "addInput", "(", "_value2Signal", ",", "2", ")", ";", "_block", ".", "addOutput", "(", "_outputSignal", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "}", "public", "void", "testGetBlockType", "(", ")", "{", "assertEquals", "(", "\"times\"", ",", "_block", ".", "getBlockType", "(", ")", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "_block", ".", "blockType", "=", "\"divide\"", ";", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "_block", ".", "blockType", "=", "\"quotient\"", ";", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "_block", ".", "blockType", "=", "\"divide\"", ";", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "_block", ".", "blockType", "=", "\"quotient\"", ";", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "}", "private", "void", "checkVarNames", "(", "CodeAndVarNames", "result", ")", "{", "assertEquals", "(", "3", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"outputSignal\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"PB\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "result", ".", "getVarName", "(", "2", ")", ")", ";", "}", "public", "void", "testDescribeSelfFileWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "assertEquals", "(", "-", "7.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "silence", "(", ")", ";", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetName", "(", ")", "{", "assertEquals", "(", "\"times_3\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"product\"", ",", "_block", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarID", "(", ")", "{", "assertEquals", "(", "\"PB\"", ",", "_block", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "_block", ".", "getVarID", "(", "2", ")", ")", ";", "}", "public", "void", "testGetInputIterator", "(", ")", "{", "Signal", "s", ";", "Iterator", "<", "Signal", ">", "it", "=", "_block", ".", "getInputIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_value1Signal", ",", "s", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_value2Signal", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutput", "(", ")", "{", "assertEquals", "(", "_outputSignal", ",", "_block", ".", "getOutput", "(", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "String", "name", ";", "Iterator", "<", "String", ">", "it", "=", "_block", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"PB\"", ",", "name", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "name", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"outputSignal\"", ",", "_block", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testSetName", "(", ")", "{", "_block", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "2", ",", "_block", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "2", ",", "_block", ".", "numVarIDs", "(", ")", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "String", "routineName", "=", "\"\"", ";", "_value1Block", ".", "setValue", "(", "4.50", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "assertEquals", "(", "9.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "}", "</s>" ]
8,413
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "junit", ".", "framework", ".", "*", ";", "public", "class", "BlockInputTest", "extends", "TestCase", "{", "private", "Signal", "_fs", ";", "private", "BlockInput", "_bi", ";", "private", "Model", "_m", ";", "private", "StringWriter", "_writer", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "_m", "=", "new", "Model", "(", "2", ",", "2", ")", ";", "_fs", "=", "new", "Signal", "(", "\"full", "signal\"", ",", "\"fulsig\"", ",", "\"deg\"", ",", "4", ",", "_m", ")", ";", "_bi", "=", "new", "BlockInput", "(", "_fs", ",", "_m", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "_m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "_bi", ".", "update", "(", ")", ";", "}", "public", "void", "testConstructor", "(", ")", "{", "Model", "m", "=", "new", "Model", "(", "1", ",", "1", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "Signal", "s", "=", "new", "Signal", "(", "\"my_signal\"", ",", "m", ")", ";", "assertTrue", "(", "s", "!=", "null", ")", ";", "Block", "b", "=", "new", "BlockInput", "(", "s", ",", "m", ")", ";", "assertTrue", "(", "b", "!=", "null", ")", ";", "assertEquals", "(", "\"input\"", ",", "b", ".", "getType", "(", ")", ")", ";", "assertEquals", "(", "\"my_signal\"", ",", "b", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "b", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "b", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "b", ".", "outputConnected", "(", ")", ")", ";", "assertEquals", "(", "\"my_signal\"", ",", "b", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "s", ",", "b", ".", "getOutput", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "_bi", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_bi", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testVerbosity", "(", ")", "{", "assertFalse", "(", "_bi", ".", "isVerbose", "(", ")", ")", ";", "_bi", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_bi", ".", "isVerbose", "(", ")", ")", ";", "_bi", ".", "silence", "(", ")", ";", "assertFalse", "(", "_bi", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testSetInputValue", "(", ")", "{", "_bi", ".", "setInputValue", "(", "-", "4.533", ")", ";", "assertEquals", "(", "-", "4.533", ",", "_bi", ".", "getValue", "(", ")", ",", "0.0000001", ")", ";", "}", "public", "void", "testGetUnits", "(", ")", "{", "assertEquals", "(", "\"deg\"", ",", "_bi", ".", "getUnits", "(", ")", ")", ";", "}", "public", "void", "testGetSeqNumber", "(", ")", "{", "assertEquals", "(", "1", ",", "_bi", ".", "getSeqNumber", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"fulsig\"", ",", "_bi", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_m", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "cvn", ".", "append", "(", "_bi", ".", "genCode", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "\"fulsig\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_m", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "cvn", ".", "append", "(", "_bi", ".", "genCode", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "\"fulsig\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "{", "try", "{", "_bi", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "BlockInputTest", ".", "class", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,414
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "ByteArrayOutputStream", ";", "import", "java", ".", "io", ".", "PrintStream", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "StaticShotTest", "extends", "TestCase", "{", "protected", "StaticShot", "_ss", ";", "protected", "final", "double", "EPS", "=", "0.00000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_ss", "=", "new", "StaticShot", "(", "genStaticShotElement", "(", ")", ")", ";", "}", "public", "void", "testStaticShot", "(", ")", "{", "assertNotNull", "(", "_ss", ")", ";", "}", "public", "void", "testGetName", "(", ")", "{", "assertEquals", "(", "\"Nominal\"", ",", "_ss", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetInputs", "(", ")", "{", "VectorInfoArrayList", "inputs", "=", "_ss", ".", "getInputs", "(", ")", ";", "assertNotNull", "(", "inputs", ")", ";", "assertEquals", "(", "3", ",", "inputs", ".", "size", "(", ")", ")", ";", "checkSignal", "(", "inputs", ",", "0", ",", "\"trueAirspeed\"", ",", "\"f_s\"", ",", "300.0", ")", ";", "checkSignal", "(", "inputs", ",", "1", ",", "\"\"", ",", "\"deg\"", ",", "5.0", ")", ";", "checkSignal", "(", "inputs", ",", "2", ",", "\"\"", ",", "\"deg\"", ",", "0.0", ")", ";", "}", "public", "void", "testGetOutputs", "(", ")", "{", "VectorInfoArrayList", "outputs", "=", "_ss", ".", "getOutputs", "(", ")", ";", "assertNotNull", "(", "outputs", ")", ";", "assertEquals", "(", "3", ",", "outputs", ".", "size", "(", ")", ")", ";", "checkSignal", "(", "outputs", ",", "0", ",", "\"\"", ",", "\"nd\"", ",", "-", "0.004", ",", "1.0e-6", ")", ";", "checkSignal", "(", "outputs", ",", "1", ",", "\"\"", ",", "\"nd\"", ",", "0.000", ",", "1.0e-6", ")", ";", "checkSignal", "(", "outputs", ",", "2", ",", "\"\"", ",", "\"nd\"", ",", "-", "0.416", ",", "1.0e-6", ")", ";", "}", "public", "void", "testLoadInputVector", "(", ")", "{", "VectorInfoArrayList", "inVec", "=", "new", "VectorInfoArrayList", "(", "3", ")", ";", "VectorInfo", "airspeed", "=", "new", "VectorInfo", "(", "\"trueAirspeed\"", ",", "\"f_s\"", ",", "null", ",", "true", ")", ";", "airspeed", ".", "setValue", "(", "300.", ")", ";", "inVec", ".", "add", "(", "airspeed", ")", ";", "VectorInfo", "alpha", "=", "new", "VectorInfo", "(", "\"\"", ",", "\"deg\"", ",", "null", ",", "true", ")", ";", "alpha", ".", "setValue", "(", "5.", ")", ";", "inVec", ".", "add", "(", "alpha", ")", ";", "try", "{", "_ss", ".", "loadInputVector", "(", "inVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", "+", "\"\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "VectorInfo", "beta", "=", "new", "VectorInfo", "(", "\"\"", ",", "\"deg\"", ",", "null", ",", "true", ")", ";", "beta", ".", "setValue", "(", "0.", ")", ";", "inVec", ".", "add", "(", "beta", ")", ";", "try", "{", "_ss", ".", "loadInputVector", "(", "inVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "String", "bad_units", "=", "\"rrr\"", ";", "beta", ".", "setUnits", "(", "bad_units", ")", ";", "try", "{", "_ss", ".", "loadInputVector", "(", "inVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", "+", "\"\"", "+", "bad_units", "+", "\"'.\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "beta", ".", "setUnits", "(", "\"deg\"", ")", ";", "try", "{", "_ss", ".", "loadInputVector", "(", "inVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "alpha", ".", "signalName", "=", "\"fart\"", ";", "try", "{", "_ss", ".", "loadInputVector", "(", "inVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testCheckOutputs", "(", ")", "{", "ByteArrayOutputStream", "myStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "PrintStream", "ps", "=", "new", "PrintStream", "(", "myStream", ")", ";", "VectorInfoArrayList", "outVec", "=", "new", "VectorInfoArrayList", "(", "3", ")", ";", "VectorInfo", "X", "=", "new", "VectorInfo", "(", "\"\"", ",", "\"nd\"", ",", "null", ",", "false", ")", ";", "X", ".", "setValue", "(", "-", "0.004", ")", ";", "X", ".", "setTolerance", "(", "1.0e-6", ")", ";", "outVec", ".", "add", "(", "X", ")", ";", "VectorInfo", "Y", "=", "new", "VectorInfo", "(", "\"\"", ",", "\"nd\"", ",", "null", ",", "false", ")", ";", "Y", ".", "setValue", "(", "0.000", ")", ";", "Y", ".", "setTolerance", "(", "1.0e-6", ")", ";", "outVec", ".", "add", "(", "Y", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", "+", "\"\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "VectorInfo", "Z", "=", "new", "VectorInfo", "(", "\"\"", ",", "\"nd\"", ",", "null", ",", "false", ")", ";", "Z", ".", "setValue", "(", "-", "0.416", ")", ";", "Z", ".", "setTolerance", "(", "1.0e-6", ")", ";", "outVec", ".", "add", "(", "Z", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "X", ".", "signalName", "=", "\"xxx\"", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "X", ".", "signalName", "=", "\"\"", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "String", "bad_units", "=", "\"rtss\"", ";", "Z", ".", "setUnits", "(", "bad_units", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "expectedMessage", "=", "\"\"", "+", "\"\"", "+", "bad_units", "+", "\"'.\"", ";", "assertEquals", "(", "expectedMessage", ",", "e", ".", "getMessage", "(", ")", ")", ";", "}", "Z", ".", "setUnits", "(", "\"nd\"", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "double", "tol", "=", "Y", ".", "getTolerance", "(", ")", ";", "double", "nomval", "=", "Y", ".", "getValue", "(", ")", ";", "Y", ".", "setValue", "(", "nomval", "+", "0.99", "*", "tol", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "Y", ".", "setValue", "(", "nomval", "+", "1.01", "*", "tol", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ",", "ps", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "String", "errMsg", ";", "String", "expectedMsg", ";", "errMsg", "=", "myStream", ".", "toString", "(", ")", ";", "String", "newline", "=", "System", ".", "getProperty", "(", "\"\"", ")", ";", "expectedMsg", "=", "newline", "+", "\"\"", "+", "newline", "+", "\"\"", "+", "newline", "+", "\"\"", "+", "newline", ";", "assertEquals", "(", "expectedMsg", ",", "errMsg", ")", ";", "myStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "ps", "=", "new", "PrintStream", "(", "myStream", ")", ";", "Y", ".", "setValue", "(", "nomval", "-", "1.01", "*", "tol", ")", ";", "try", "{", "_ss", ".", "checkOutputs", "(", "outVec", ",", "ps", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "errMsg", "=", "myStream", ".", "toString", "(", ")", ";", "expectedMsg", "=", "newline", "+", "\"\"", "+", "newline", "+", "\"\"", "+", "newline", "+", "\"\"", "+", "newline", ";", "assertEquals", "(", "expectedMsg", ",", "errMsg", ")", ";", "}", "protected", "Element", "genStaticShotElement", "(", ")", "{", "Element", "staticShot", "=", "new", "Element", "(", "\"staticShot\"", ")", ";", "staticShot", ".", "setAttribute", "(", "\"name\"", ",", "\"Nominal\"", ")", ";", "staticShot", ".", "setAttribute", "(", "\"refID\"", ",", "\"NOTE1\"", ")", ";", "Element", "checkInputs", "=", "new", "Element", "(", "\"checkInputs\"", ")", ";", "Element", "inputSignal1", "=", "buildSignalElement", "(", "\"trueAirspeed\"", ",", "\"f_s\"", ",", "\"", "300.000\"", ")", ";", "checkInputs", ".", "addContent", "(", "inputSignal1", ")", ";", "Element", "inputSignal2", "=", "buildSignalElement", "(", "\"\"", ",", "\"deg\"", ",", "\"", "5.000\"", ")", ";", "checkInputs", ".", "addContent", "(", "inputSignal2", ")", ";", "Element", "inputSignal3", "=", "buildSignalElement", "(", "\"\"", ",", "\"deg\"", ",", "\"", "0.000\"", ")", ";", "checkInputs", ".", "addContent", "(", "inputSignal3", ")", ";", "staticShot", ".", "addContent", "(", "checkInputs", ")", ";", "Element", "internalValues", "=", "new", "Element", "(", "\"\"", ")", ";", "Element", "internalSignal1", "=", "buildSignalElement", "(", "\"vt\"", ",", "\"300.0\"", ")", ";", "internalValues", ".", "addContent", "(", "internalSignal1", ")", ";", "Element", "internalSignal2", "=", "buildSignalElement", "(", "\"alpha\"", ",", "\"5.0\"", ")", ";", "internalValues", ".", "addContent", "(", "internalSignal2", ")", ";", "Element", "internalSignal3", "=", "buildSignalElement", "(", "\"beta\"", ",", "\"0.0\"", ")", ";", "internalValues", ".", "addContent", "(", "internalSignal3", ")", ";", "staticShot", ".", "addContent", "(", "internalValues", ")", ";", "Element", "checkOutputs", "=", "new", "Element", "(", "\"checkOutputs\"", ")", ";", "Element", "outputSignal1", "=", "buildSignalElement", "(", "\"\"", ",", "\"nd\"", ",", "\"\"", ",", "\"0.000001\"", ")", ";", "checkOutputs", ".", "addContent", "(", "outputSignal1", ")", ";", "Element", "outputSignal2", "=", "buildSignalElement", "(", "\"\"", ",", "\"nd\"", ",", "\"\"", ",", "\"0.000001\"", ")", ";", "checkOutputs", ".", "addContent", "(", "outputSignal2", ")", ";", "Element", "outputSignal3", "=", "buildSignalElement", "(", "\"\"", ",", "\"nd\"", ",", "\"\"", ",", "\"0.000001\"", ")", ";", "checkOutputs", ".", "addContent", "(", "outputSignal3", ")", ";", "staticShot", ".", "addContent", "(", "checkOutputs", ")", ";", "return", "staticShot", ";", "}", "protected", "Element", "buildSignalElement", "(", "String", "name", ",", "String", "units", ",", "String", "value", ")", "{", "Element", "signal", "=", "new", "Element", "(", "\"signal\"", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"signalName\"", ")", ".", "addContent", "(", "name", ")", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"signalUnits\"", ")", ".", "addContent", "(", "units", ")", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"signalValue\"", ")", ".", "addContent", "(", "value", ")", ")", ";", "return", "signal", ";", "}", "protected", "Element", "buildSignalElement", "(", "String", "varID", ",", "String", "value", ")", "{", "Element", "signal", "=", "new", "Element", "(", "\"signal\"", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"varID\"", ")", ".", "addContent", "(", "varID", ")", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"signalValue\"", ")", ".", "addContent", "(", "value", ")", ")", ";", "return", "signal", ";", "}", "protected", "Element", "buildSignalElement", "(", "String", "name", ",", "String", "units", ",", "String", "value", ",", "String", "tol", ")", "{", "Element", "signal", "=", "buildSignalElement", "(", "name", ",", "units", ",", "value", ")", ";", "signal", ".", "addContent", "(", "new", "Element", "(", "\"tol\"", ")", ".", "addContent", "(", "tol", ")", ")", ";", "return", "signal", ";", "}", "protected", "void", "checkSignal", "(", "VectorInfoArrayList", "signals", ",", "int", "index", ",", "String", "name", ",", "String", "units", ",", "double", "value", ")", "{", "checkSignal", "(", "signals", ",", "index", ",", "name", ",", "units", ",", "value", ",", "Double", ".", "NaN", ")", ";", "}", "protected", "void", "checkSignal", "(", "VectorInfoArrayList", "signals", ",", "int", "index", ",", "String", "name", ",", "String", "units", ",", "double", "value", ",", "double", "tolerance", ")", "{", "VectorInfo", "signal", ";", "assertNotNull", "(", "signals", ")", ";", "signal", "=", "signals", ".", "get", "(", "index", ")", ";", "assertNotNull", "(", "signal", ")", ";", "assertEquals", "(", "name", ",", "signal", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "units", ",", "signal", ".", "getUnits", "(", ")", ")", ";", "assertEquals", "(", "value", ",", "signal", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "assertEquals", "(", "tolerance", ",", "signal", ".", "getTolerance", "(", ")", ",", "EPS", ")", ";", "}", "}", "</s>" ]
8,415
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "*", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "SignalTest", "extends", "TestCase", "{", "private", "Signal", "_ds", ";", "private", "Signal", "_ss", ";", "private", "Signal", "_fs", ";", "private", "Signal", "_cs", ";", "private", "Block", "_bc", ";", "private", "Block", "_bd", ";", "private", "Model", "_m", ";", "private", "final", "double", "eps", "=", "1e-6", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "{", "_m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_ds", "=", "new", "Signal", "(", ")", ";", "_ss", "=", "new", "Signal", "(", "\"new", "signal\"", ",", "_m", ")", ";", "_fs", "=", "new", "Signal", "(", "\"full", "signal\"", ",", "\"fulsig\"", ",", "\"deg\"", ",", "4", ",", "_m", ")", ";", "_fs", ".", "setLowerLimit", "(", "-", "3.45", ")", ";", "_fs", ".", "setUpperLimit", "(", "67.8", ")", ";", "_bc", "=", "new", "BlockMathConstant", "(", "\"-3.45\"", ",", "_m", ")", ";", "_bd", "=", "new", "BlockOutput", "(", "_ss", ",", "_m", ")", ";", "}", "public", "void", "testToValidId", "(", ")", "{", "String", "input", "=", "\"\"", ";", "String", "expected", "=", "\"\"", ";", "assertTrue", "(", "Signal", ".", "toValidId", "(", "input", ")", ".", "equals", "(", "expected", ")", ")", ";", "input", "=", "\"\"", ";", "expected", "=", "\"\"", ";", "assertTrue", "(", "Signal", ".", "toValidId", "(", "input", ")", ".", "equals", "(", "expected", ")", ")", ";", "}", "public", "void", "testDefaultCtor", "(", ")", "{", "assertTrue", "(", "(", "_ds", ".", "getName", "(", ")", ".", "equals", "(", "\"unnamed\"", ")", ")", ")", ";", "try", "{", "assertTrue", "(", "_ds", ".", "sourceReady", "(", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "assertTrue", "(", "true", ")", ";", "}", "assertTrue", "(", "(", "_ds", ".", "getVarID", "(", ")", ".", "equals", "(", "\"unnamed\"", ")", ")", ")", ";", "assertTrue", "(", "(", "_ds", ".", "getUnits", "(", ")", "==", "null", "?", "\"\"", "==", "null", ":", "_ds", ".", "getUnits", "(", ")", ".", "equals", "(", "\"\"", ")", ")", ")", ";", "assertTrue", "(", "_ds", ".", "getSource", "(", ")", "==", "null", ")", ";", "assertTrue", "(", "_ds", ".", "getSourcePort", "(", ")", "==", "0", ")", ";", "assertFalse", "(", "_ds", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isStdAIAA", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isDerived", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isDefined", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasLowerLimit", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasUpperLimit", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "isLimited", "(", ")", ")", ";", "assertTrue", "(", "Double", ".", "isInfinite", "(", "_ds", ".", "getLowerLimit", "(", ")", ")", ")", ";", "assertTrue", "(", "Double", ".", "isInfinite", "(", "_ds", ".", "getUpperLimit", "(", ")", ")", ")", ";", "}", "public", "void", "testFullCtor", "(", ")", "{", "assertTrue", "(", "(", "_fs", ".", "getName", "(", ")", "==", "null", "?", "\"full", "signal\"", "==", "null", ":", "_fs", ".", "getName", "(", ")", ".", "equals", "(", "\"full", "signal\"", ")", ")", ")", ";", "assertTrue", "(", "(", "_fs", ".", "getVarID", "(", ")", "==", "null", "?", "\"fulsig\"", "==", "null", ":", "_fs", ".", "getVarID", "(", ")", ".", "equals", "(", "\"fulsig\"", ")", ")", ")", ";", "assertTrue", "(", "(", "_fs", ".", "getUnits", "(", ")", "==", "null", "?", "\"deg\"", "==", "null", ":", "_fs", ".", "getUnits", "(", ")", ".", "equals", "(", "\"deg\"", ")", ")", ")", ";", "assertTrue", "(", "_fs", ".", "getSource", "(", ")", "==", "null", ")", ";", "assertTrue", "(", "_fs", ".", "getSourcePort", "(", ")", "==", "0", ")", ";", "assertFalse", "(", "_fs", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDerived", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDefined", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "hasLowerLimit", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "-", "3.45", ",", "_fs", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "assertEquals", "(", "67.8", ",", "_fs", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "}", "public", "void", "testSingleSignal", "(", ")", "{", "assertTrue", "(", "_bd", "!=", "null", ")", ";", "assertTrue", "(", "_ss", ".", "getName", "(", ")", ".", "equals", "(", "\"new", "signal\"", ")", ")", ";", "try", "{", "assertTrue", "(", "_ss", ".", "sourceReady", "(", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "assertTrue", "(", "true", ")", ";", "}", "try", "{", "_bc", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_bc", ".", "addOutput", "(", "_ss", ")", ";", "assertTrue", "(", "_ss", ".", "sourceReady", "(", ")", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "assertEquals", "(", "-", "3.45", ",", "_ss", ".", "sourceValue", "(", ")", ",", "0.0000001", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertTrue", "(", "_ss", ".", "getVarID", "(", ")", ".", "equals", "(", "\"new_signal\"", ")", ")", ";", "assertTrue", "(", "_ss", ".", "getUnits", "(", ")", ".", "equals", "(", "\"unkn\"", ")", ")", ";", "assertTrue", "(", "_ss", ".", "getSource", "(", ")", "==", "_bc", ")", ";", "assertTrue", "(", "_ss", ".", "getSourcePort", "(", ")", "==", "1", ")", ";", "assertTrue", "(", "_ss", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "_ss", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isStdAIAA", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isDerived", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isDefined", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "hasLowerLimit", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "hasUpperLimit", "(", ")", ")", ";", "assertFalse", "(", "_ss", ".", "isLimited", "(", ")", ")", ";", "assertTrue", "(", "Double", ".", "isInfinite", "(", "_ss", ".", "getLowerLimit", "(", ")", ")", ")", ";", "assertTrue", "(", "Double", ".", "isInfinite", "(", "_ss", ".", "getUpperLimit", "(", ")", ")", ")", ";", "BlockArrayList", "dests", "=", "_ss", ".", "getDests", "(", ")", ";", "assertTrue", "(", "dests", "!=", "null", ")", ";", "assertTrue", "(", "dests", ".", "size", "(", ")", "==", "1", ")", ";", "Iterator", "<", "Block", ">", "dbi", "=", "dests", ".", "iterator", "(", ")", ";", "assertTrue", "(", "dbi", ".", "hasNext", "(", ")", ")", ";", "Block", "destBlock", "=", "(", "Block", ")", "dbi", ".", "next", "(", ")", ";", "assertTrue", "(", "destBlock", "==", "_bd", ")", ";", "ArrayList", "<", "Integer", ">", "destPorts", "=", "_ss", ".", "getDestPortNumbers", "(", ")", ";", "assertTrue", "(", "destPorts", "!=", "null", ")", ";", "assertTrue", "(", "destPorts", ".", "size", "(", ")", "==", "1", ")", ";", "Iterator", "<", "Integer", ">", "dpi", "=", "destPorts", ".", "iterator", "(", ")", ";", "assertTrue", "(", "dpi", ".", "hasNext", "(", ")", ")", ";", "Integer", "destPort", "=", "(", "Integer", ")", "dpi", ".", "next", "(", ")", ";", "assertTrue", "(", "destPort", "==", "1", ")", ";", "}", "private", "void", "checkCode", "(", "int", "lang", ",", "Signal", "sig", ",", "String", "id", ")", "{", "CodeAndVarNames", "cvn", ";", "_m", ".", "setCodeDialect", "(", "lang", ")", ";", "sig", ".", "clearDerivedFlag", "(", ")", ";", "cvn", "=", "sig", ".", "genCode", "(", ")", ";", "assertFalse", "(", "cvn", ".", "getVarNames", "(", ")", "==", "null", ")", ";", "assertEquals", "(", "1", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "id", ".", "equals", "(", "cvn", ".", "getVarName", "(", "0", ")", ")", ")", ";", "assertTrue", "(", "id", ".", "equals", "(", "cvn", ".", "getCode", "(", ")", ")", ")", ";", "assertFalse", "(", "sig", ".", "isDefined", "(", ")", ")", ";", "sig", ".", "clearDefinedFlag", "(", ")", ";", "sig", ".", "setDerivedFlag", "(", ")", ";", "cvn", "=", "sig", ".", "genCode", "(", ")", ";", "assertFalse", "(", "cvn", ".", "getVarNames", "(", ")", "==", "null", ")", ";", "assertEquals", "(", "0", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "\"\"", ".", "equals", "(", "cvn", ".", "getCode", "(", ")", ")", ")", ";", "assertFalse", "(", "sig", ".", "isDefined", "(", ")", ")", ";", "}", "private", "void", "checkCode", "(", "Signal", "sig", ",", "String", "id", ")", "{", "checkCode", "(", "Model", ".", "DT_ANSI_C", ",", "sig", ",", "id", ")", ";", "sig", ".", "clearDefinedFlag", "(", ")", ";", "checkCode", "(", "Model", ".", "DT_FORTRAN", ",", "sig", ",", "id", ")", ";", "}", "public", "void", "testGenCode_DefaultSignal", "(", ")", "{", "Signal", "sig", "=", "_ds", ";", "String", "id", "=", "\"unnamed\"", ";", "checkCode", "(", "sig", ",", "id", ")", ";", "}", "public", "void", "testGenCode_SingleSignal", "(", ")", "{", "Signal", "sig", "=", "_ss", ";", "String", "id", "=", "\"new_signal\"", ";", "checkCode", "(", "sig", ",", "id", ")", ";", "}", "public", "void", "testGenCode_FullSignal", "(", ")", "{", "Signal", "sig", "=", "_fs", ";", "String", "id", "=", "\"fulsig\"", ";", "checkCode", "(", "sig", ",", "id", ")", ";", "}", "public", "void", "testVerbose", "(", ")", "{", "assertFalse", "(", "_ss", ".", "isVerbose", "(", ")", ")", ";", "_ss", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_ss", ".", "isVerbose", "(", ")", ")", ";", "_ss", ".", "silence", "(", ")", ";", "assertFalse", "(", "_ss", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testSetGetLimits", "(", ")", "{", "_ds", ".", "setLowerLimit", "(", "\"-2.0\"", ")", ";", "assertTrue", "(", "_ds", ".", "hasLowerLimit", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "-", "2.0", ",", "_ds", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "_ds", ".", "setLowerLimit", "(", "-", "4.0", ")", ";", "assertTrue", "(", "_ds", ".", "hasLowerLimit", "(", ")", ")", ";", "assertFalse", "(", "_ds", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "-", "4.0", ",", "_ds", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "_ds", ".", "setUpperLimit", "(", "\"+15.5\"", ")", ";", "assertTrue", "(", "_ds", ".", "hasLowerLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "+", "15.5", ",", "_ds", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "assertEquals", "(", "-", "4.0", ",", "_ds", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "_ds", ".", "setUpperLimit", "(", "15.1", ")", ";", "assertTrue", "(", "_ds", ".", "hasLowerLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "_ds", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "+", "15.1", ",", "_ds", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "assertEquals", "(", "-", "4.0", ",", "_ds", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "}", "public", "void", "testClearIsOutputFlag", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isOutput\"", ",", "null", ")", ";", "_fs", ".", "clearIsOutputFlag", "(", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "}", "public", "void", "testDeepCopy", "(", ")", "{", "Signal", "s2", "=", "new", "Signal", "(", "_fs", ")", ";", "assertTrue", "(", "s2", ".", "getName", "(", ")", ".", "equals", "(", "\"full", "signal\"", ")", ")", ";", "assertTrue", "(", "s2", ".", "getVarID", "(", ")", ".", "equals", "(", "\"fulsig\"", ")", ")", ";", "assertTrue", "(", "s2", ".", "getUnits", "(", ")", ".", "equals", "(", "\"deg\"", ")", ")", ";", "assertTrue", "(", "s2", ".", "getSource", "(", ")", "==", "null", ")", ";", "assertTrue", "(", "s2", ".", "getSourcePort", "(", ")", "==", "0", ")", ";", "assertFalse", "(", "s2", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isStdAIAA", "(", ")", ")", ";", "assertFalse", "(", "s2", ".", "isDerived", "(", ")", ")", ";", "assertTrue", "(", "s2", ".", "hasLowerLimit", "(", ")", ")", ";", "assertTrue", "(", "s2", ".", "hasUpperLimit", "(", ")", ")", ";", "assertTrue", "(", "s2", ".", "isLimited", "(", ")", ")", ";", "assertEquals", "(", "-", "3.45", ",", "s2", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "assertEquals", "(", "67.8", ",", "s2", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "try", "{", "assertTrue", "(", "_ds", ".", "sourceReady", "(", ")", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "assertTrue", "(", "true", ")", ";", "}", "}", "public", "void", "testSignalMarkedAsInput", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isInput\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsControl", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isControl\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsDisturbance", "(", ")", "{", "setFullSignalWithFlags", "(", "\"\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalIncorrectlyMarkedAsBothInputAndControl", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isInput\"", ",", "\"isControl\"", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalIncorrectlyMarkedAsBothInputAndDisturbance", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isInput\"", ",", "\"\"", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalIncorrectlyMarkedAsBothControlAndDisturbance", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isControl\"", ",", "\"\"", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsState", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isState\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsStateDeriv", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isStateDeriv\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsOutput", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isOutput\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalMarkedAsStdAIAA", "(", ")", "{", "setFullSignalWithFlags", "(", "\"isStdAIAA\"", ",", "null", ")", ";", "assertFalse", "(", "_fs", ".", "hasIC", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isInput", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isControl", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDisturbance", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isState", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isStateDeriv", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isOutput", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "isStdAIAA", "(", ")", ")", ";", "}", "public", "void", "testSignalWithICBelowMinLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "-", "100.", ",", "-", "2.", ",", "null", ",", "-", "2.", ")", ";", "}", "public", "void", "testSignalWithICAboveMinLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "100.", ",", "-", "2.", ",", "null", ",", "100.", ")", ";", "}", "public", "void", "testSignalWithICBelowMaxLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "1.", ",", "null", ",", "2.", ",", "1.", ")", ";", "}", "public", "void", "testSignalWithICAboveMaxLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "100.", ",", "null", ",", "2.", ",", "2.", ")", ";", "}", "public", "void", "testSignalWithICBelowMinMaxLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "-", "100.", ",", "-", "2.", ",", "2.", ",", "-", "2.", ")", ";", "}", "public", "void", "testSignalWithICInsideMinMaxLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "1.", ",", "-", "2.", ",", "2.", ",", "1.", ")", ";", "}", "public", "void", "testSignalWithICAboveMinMaxLimit", "(", ")", "{", "buildAndTestSignalWithIcPlusLimit", "(", "100.", ",", "-", "2.", ",", "2.", ",", "2.", ")", ";", "}", "public", "void", "testSignalWithCalcBelowMinLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "-", "0.5", ",", "23.5", ",", "-", "1.", ",", "null", ",", "-", "1.", ")", ";", "}", "public", "void", "testSignalWithCalcAboveMinLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "0.0", ",", "23.5", ",", "-", "1.", ",", "null", ",", "0.", ")", ";", "}", "public", "void", "testSignalWithCalcBelowMaxLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "0.5", ",", "0.1", ",", "null", ",", "+", "1.", ",", "0.05", ")", ";", "}", "public", "void", "testSignalWithCalcAboveMaxLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "+", "0.5", ",", "23.5", ",", "null", ",", "+", "1.", ",", "+", "1.", ")", ";", "}", "public", "void", "testSignalWithCalcBelowMinMaxLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "-", "0.5", ",", "23.5", ",", "-", "1.", ",", "+", "1.", ",", "-", "1.", ")", ";", "}", "public", "void", "testSignalWithCalcInsideMinMaxLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "-", "0.5", ",", "0.1", ",", "-", "1.", ",", "+", "1.", ",", "-", "0.05", ")", ";", "}", "public", "void", "testSignalWithCalcAboveMinMaxLimit", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "+", "0.5", ",", "23.5", ",", "-", "1.", ",", "+", "1.", ",", "+", "1.", ")", ";", "}", "public", "void", "testSignalElementWithNumericConstant_ctor", "(", ")", "{", "_ds", "=", "null", ";", "_ss", "=", "null", ";", "_fs", "=", "null", ";", "_bc", "=", "null", ";", "_bd", "=", "null", ";", "Element", "theDesc1", "=", "new", "Element", "(", "\"description\"", ")", ";", "theDesc1", ".", "addContent", "(", "\"\"", ")", ";", "Element", "theValue", "=", "new", "Element", "(", "\"cn\"", ")", ";", "theValue", ".", "addContent", "(", "\"-6.78\"", ")", ";", "Element", "absElement", "=", "new", "Element", "(", "\"abs\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "absElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue", ")", ";", "Element", "mathElement", "=", "new", "Element", "(", "\"math\"", ")", ";", "mathElement", ".", "addContent", "(", "applyElement", ")", ";", "Element", "calcElement", "=", "new", "Element", "(", "\"calculation\"", ")", ";", "calcElement", ".", "addContent", "(", "mathElement", ")", ";", "Element", "calcVarDef", ";", "calcVarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"calcVar\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"dv\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "calcVarDef", ".", "addContent", "(", "theDesc1", ")", ";", "calcVarDef", ".", "addContent", "(", "calcElement", ")", ";", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "Signal", "theSignal", "=", "new", "Signal", "(", "calcVarDef", ",", "m", ")", ";", "assertTrue", "(", "theSignal", "!=", "null", ")", ";", "assertTrue", "(", "theSignal", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "theSignal", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "theSignal", ".", "hasIC", "(", ")", ")", ";", "Block", "abs_1", "=", "theSignal", ".", "getSource", "(", ")", ";", "assertTrue", "(", "abs_1", "!=", "null", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "abs_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"const_1\"", ",", "abs_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "abs_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "theSignal", ",", "abs_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "2", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "try", "{", "m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "assertEquals", "(", "6.78", ",", "theSignal", ".", "sourceValue", "(", ")", ",", "0.0000001", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "m", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "assertTrue", "(", "theSignal", ".", "genCode", "(", ")", ".", "getCode", "(", ")", ".", "equals", "(", "\"dv\"", ")", ")", ";", "}", "public", "void", "testSignalElementWithBlockConstant_ctor", "(", ")", "{", "_ds", "=", "null", ";", "_ss", "=", "null", ";", "_fs", "=", "null", ";", "_bc", "=", "null", ";", "_bd", "=", "null", ";", "Element", "theDesc1", "=", "new", "Element", "(", "\"description\"", ")", ";", "theDesc1", ".", "addContent", "(", "\"\"", ")", ";", "Element", "theValue", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue", ".", "addContent", "(", "\"beta\"", ")", ";", "Element", "absElement", "=", "new", "Element", "(", "\"abs\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "absElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue", ")", ";", "Element", "mathElement", "=", "new", "Element", "(", "\"math\"", ")", ";", "mathElement", ".", "addContent", "(", "applyElement", ")", ";", "Element", "calcElement", "=", "new", "Element", "(", "\"calculation\"", ")", ";", "calcElement", ".", "addContent", "(", "mathElement", ")", ";", "Element", "calcVarDef", ";", "Element", "constVarDef", ";", "calcVarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"calcVar\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"dv\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "calcVarDef", ".", "addContent", "(", "theDesc1", ")", ";", "calcVarDef", ".", "addContent", "(", "calcElement", ")", ";", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "constVarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "constVarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"beta\"", ")", ";", "constVarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"beta\"", ")", ";", "constVarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "constVarDef", ".", "setAttribute", "(", "\"initialValue\"", ",", "\"-6.78\"", ")", ";", "Signal", "beta", "=", "new", "Signal", "(", "constVarDef", ",", "m", ")", ";", "assertTrue", "(", "beta", "!=", "null", ")", ";", "assertFalse", "(", "beta", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "beta", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "beta", ".", "hasIC", "(", ")", ")", ";", "Signal", "dv", "=", "new", "Signal", "(", "calcVarDef", ",", "m", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "Block", "abs_1", "=", "dv", ".", "getSource", "(", ")", ";", "assertTrue", "(", "abs_1", "!=", "null", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "abs_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numVarIDs", "(", ")", ")", ";", "assertFalse", "(", "abs_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "abs_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "abs_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "abs_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "m", ".", "wireBlocks", "(", ")", ";", "assertTrue", "(", "beta", "!=", "null", ")", ";", "assertFalse", "(", "beta", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "beta", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "beta", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "abs_1", "!=", "null", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "abs_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "abs_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "abs_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "abs_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "m", ".", "hookUpIO", "(", ")", ";", "assertTrue", "(", "beta", "!=", "null", ")", ";", "assertTrue", "(", "beta", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "beta", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "beta", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "abs_1", "!=", "null", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "abs_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "abs_1", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "abs_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "abs_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "abs_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "abs_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "3", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "try", "{", "m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "assertTrue", "(", "dv", ".", "sourceReady", "(", ")", ")", ";", "assertEquals", "(", "6.78", ",", "dv", ".", "sourceValue", "(", ")", ",", "0.0000001", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "m", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "assertTrue", "(", "beta", ".", "genCode", "(", ")", ".", "getCode", "(", ")", ".", "equals", "(", "\"beta\"", ")", ")", ";", "assertTrue", "(", "dv", ".", "genCode", "(", ")", ".", "getCode", "(", ")", ".", "equals", "(", "\"dv\"", ")", ")", ";", "}", "public", "void", "testSignalElementWithCalculation", "(", ")", "{", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "0.5", ",", "23.5", ",", "null", ",", "null", ",", "0.5", "*", "23.5", ")", ";", "}", "private", "void", "buildAndTestModelWithCalcAndMinMaxLimits", "(", "Double", "a", ",", "Double", "b", ",", "Double", "min", ",", "Double", "max", ",", "Double", "expectedValue", ")", "{", "Model", "m", "=", "buildModelWithCalculationATimeBAndMinMaxLimits", "(", "a", ",", "b", ",", "min", ",", "max", ")", ";", "try", "{", "m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "SignalArrayList", "sal", "=", "m", ".", "getSignals", "(", ")", ";", "Signal", "dv", "=", "sal", ".", "findByID", "(", "\"dv\"", ")", ";", "assertNotNull", "(", "dv", ")", ";", "try", "{", "assertTrue", "(", "dv", ".", "sourceReady", "(", ")", ")", ";", "assertEquals", "(", "expectedValue", ",", "dv", ".", "sourceValue", "(", ")", ",", "0.0000001", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "private", "Model", "buildModelWithCalculationATimeBAndMinMaxLimits", "(", "Double", "a", ",", "Double", "b", ",", "Double", "min", ",", "Double", "max", ")", "{", "boolean", "calcIsLimited", "=", "false", ";", "Element", "theDesc1", "=", "new", "Element", "(", "\"description\"", ")", ";", "theDesc1", ".", "addContent", "(", "\"\"", ")", ";", "Element", "firstArg", "=", "new", "Element", "(", "\"ci\"", ")", ";", "firstArg", ".", "addContent", "(", "\"A\"", ")", ";", "Element", "secondArg", "=", "new", "Element", "(", "\"ci\"", ")", ";", "secondArg", ".", "addContent", "(", "\"B\"", ")", ";", "Element", "timesElement", "=", "new", "Element", "(", "\"times\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "timesElement", ")", ";", "applyElement", ".", "addContent", "(", "firstArg", ")", ";", "applyElement", ".", "addContent", "(", "secondArg", ")", ";", "Element", "mathElement", "=", "new", "Element", "(", "\"math\"", ")", ";", "mathElement", ".", "addContent", "(", "applyElement", ")", ";", "Element", "calcElement", "=", "new", "Element", "(", "\"calculation\"", ")", ";", "calcElement", ".", "addContent", "(", "mathElement", ")", ";", "Element", "calcVarDef", ";", "Element", "arg1VarDef", ";", "Element", "arg2VarDef", ";", "calcVarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"calcVar\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"dv\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "calcVarDef", ".", "addContent", "(", "theDesc1", ")", ";", "calcVarDef", ".", "addContent", "(", "calcElement", ")", ";", "if", "(", "min", "!=", "null", ")", "{", "calcVarDef", ".", "setAttribute", "(", "\"minValue\"", ",", "min", ".", "toString", "(", ")", ")", ";", "calcIsLimited", "=", "true", ";", "}", "if", "(", "max", "!=", "null", ")", "{", "calcVarDef", ".", "setAttribute", "(", "\"maxValue\"", ",", "max", ".", "toString", "(", ")", ")", ";", "calcIsLimited", "=", "true", ";", "}", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "arg1VarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "arg1VarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"a\"", ")", ";", "arg1VarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"A\"", ")", ";", "arg1VarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"r_s\"", ")", ";", "arg1VarDef", ".", "setAttribute", "(", "\"initialValue\"", ",", "a", ".", "toString", "(", ")", ")", ";", "Signal", "aSig", "=", "new", "Signal", "(", "arg1VarDef", ",", "m", ")", ";", "assertTrue", "(", "aSig", "!=", "null", ")", ";", "assertFalse", "(", "aSig", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "aSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "aSig", ".", "hasIC", "(", ")", ")", ";", "arg2VarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "arg2VarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"b\"", ")", ";", "arg2VarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"B\"", ")", ";", "arg2VarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"ft\"", ")", ";", "arg2VarDef", ".", "setAttribute", "(", "\"initialValue\"", ",", "b", ".", "toString", "(", ")", ")", ";", "Signal", "bSig", "=", "new", "Signal", "(", "arg2VarDef", ",", "m", ")", ";", "assertTrue", "(", "bSig", "!=", "null", ")", ";", "assertFalse", "(", "bSig", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "bSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "bSig", ".", "hasIC", "(", ")", ")", ";", "Signal", "dv", "=", "new", "Signal", "(", "calcVarDef", ",", "m", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "Block", "times_1", "=", "dv", ".", "getSource", "(", ")", ";", "assertTrue", "(", "times_1", "!=", "null", ")", ";", "assertEquals", "(", "\"times_1\"", ",", "times_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numVarIDs", "(", ")", ")", ";", "assertFalse", "(", "times_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"A\"", ",", "times_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"B\"", ",", "times_1", ".", "getVarID", "(", "2", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "times_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "times_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "times_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "m", ".", "wireBlocks", "(", ")", ";", "assertTrue", "(", "aSig", "!=", "null", ")", ";", "assertFalse", "(", "aSig", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "aSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "aSig", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "bSig", "!=", "null", ")", ";", "assertFalse", "(", "bSig", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "bSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "bSig", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "times_1", "!=", "null", ")", ";", "assertEquals", "(", "\"times_1\"", ",", "times_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "times_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"A\"", ",", "times_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"B\"", ",", "times_1", ".", "getVarID", "(", "2", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "times_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "times_1", ".", "getOutput", "(", ")", ")", ";", "assertTrue", "(", "times_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "m", ".", "hookUpIO", "(", ")", ";", "assertTrue", "(", "aSig", "!=", "null", ")", ";", "assertTrue", "(", "aSig", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "aSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "aSig", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "bSig", "!=", "null", ")", ";", "assertTrue", "(", "bSig", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "bSig", ".", "hasDest", "(", ")", ")", ";", "assertTrue", "(", "bSig", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "dv", "!=", "null", ")", ";", "assertTrue", "(", "dv", ".", "hasSource", "(", ")", ")", ";", "assertTrue", "(", "dv", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "dv", ".", "hasIC", "(", ")", ")", ";", "assertTrue", "(", "times_1", "!=", "null", ")", ";", "assertEquals", "(", "\"times_1\"", ",", "times_1", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "times_1", ".", "numVarIDs", "(", ")", ")", ";", "assertTrue", "(", "times_1", ".", "allInputsConnected", "(", ")", ")", ";", "assertEquals", "(", "\"A\"", ",", "times_1", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"B\"", ",", "times_1", ".", "getVarID", "(", "2", ")", ")", ";", "if", "(", "calcIsLimited", ")", "{", "assertEquals", "(", "\"dv_unlim\"", ",", "times_1", ".", "getOutputVarID", "(", ")", ")", ";", "}", "else", "{", "assertEquals", "(", "\"dv\"", ",", "times_1", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "dv", ",", "times_1", ".", "getOutput", "(", ")", ")", ";", "}", "assertTrue", "(", "times_1", ".", "outputConnected", "(", ")", ")", ";", "assertTrue", "(", "m", "!=", "null", ")", ";", "if", "(", "calcIsLimited", ")", "{", "assertEquals", "(", "5", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "4", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "}", "else", "{", "assertEquals", "(", "4", ",", "m", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "m", ".", "getNumSignals", "(", ")", ")", ";", "}", "assertEquals", "(", "0", ",", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "return", "m", ";", "}", "private", "void", "buildAndTestSignalWithIcPlusLimit", "(", "Double", "ic", ",", "Double", "min", ",", "Double", "max", ",", "Double", "expectedValue", ")", "{", "_m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "VectorInfoArrayList", "outputs", "=", "null", ";", "VectorInfoArrayList", "inputs", "=", "null", ";", "String", "icString", "=", "null", ";", "String", "minString", "=", "null", ";", "String", "maxString", "=", "null", ";", "if", "(", "ic", "!=", "null", ")", "icString", "=", "ic", ".", "toString", "(", ")", ";", "if", "(", "min", "!=", "null", ")", "minString", "=", "min", ".", "toString", "(", ")", ";", "if", "(", "max", "!=", "null", ")", "maxString", "=", "max", ".", "toString", "(", ")", ";", "setFullSignalWithICMinMax", "(", "icString", ",", "minString", ",", "maxString", ")", ";", "BlockArrayList", "dests", "=", "_fs", ".", "getDests", "(", ")", ";", "assertTrue", "(", "dests", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "dests", ".", "size", "(", ")", ")", ";", "Block", "blk", "=", "dests", ".", "get", "(", "0", ")", ";", "assertTrue", "(", "blk", "!=", "null", ")", ";", "assertTrue", "(", "blk", "instanceof", "BlockLimiter", ")", ";", "BlockLimiter", "limBlk", "=", "(", "BlockLimiter", ")", "blk", ";", "assertTrue", "(", "(", "min", "==", "null", ")", "^", "limBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "assertTrue", "(", "(", "max", "==", "null", ")", "^", "limBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "if", "(", "min", "!=", "null", ")", "assertEquals", "(", "min", ",", "limBlk", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "if", "(", "max", "!=", "null", ")", "assertEquals", "(", "max", ",", "limBlk", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "try", "{", "outputs", "=", "_m", ".", "getOutputVector", "(", ")", ";", "inputs", "=", "_m", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "1", ",", "outputs", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "inputs", ".", "size", "(", ")", ")", ";", "VectorInfo", "output", "=", "outputs", ".", "get", "(", "0", ")", ";", "try", "{", "_m", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "expectedValue", ",", "output", ".", "getValue", "(", ")", ",", "eps", ")", ";", "}", "private", "void", "setFullSignalWithFlags", "(", "String", "flagValue1", ",", "String", "flagValue2", ")", "{", "_fs", "=", "null", ";", "Element", "theDesc1", "=", "new", "Element", "(", "\"description\"", ")", ";", "theDesc1", ".", "addContent", "(", "\"\"", ")", ";", "Element", "calcVarDef", ";", "Element", "flag1", "=", "new", "Element", "(", "flagValue1", ")", ";", "Element", "flag2", "=", "null", ";", "if", "(", "flagValue2", "!=", "null", ")", "flag2", "=", "new", "Element", "(", "flagValue2", ")", ";", "calcVarDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"name\"", ",", "\"theVar\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"dv\"", ")", ";", "calcVarDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "calcVarDef", ".", "addContent", "(", "theDesc1", ")", ";", "calcVarDef", ".", "addContent", "(", "flag1", ")", ";", "if", "(", "flagValue2", "!=", "null", ")", "calcVarDef", ".", "addContent", "(", "flag2", ")", ";", "_fs", "=", "new", "Signal", "(", "calcVarDef", ",", "_m", ")", ";", "assertEquals", "(", "\"theVar\"", ",", "_fs", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "_fs", ".", "getVarID", "(", ")", ")", ";", "assertEquals", "(", "\"deg\"", ",", "_fs", ".", "getUnits", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "getSource", "(", ")", "==", "null", ")", ";", "assertTrue", "(", "_fs", ".", "getSourcePort", "(", ")", "==", "0", ")", ";", "assertFalse", "(", "_fs", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDerived", "(", ")", ")", ";", "}", "private", "void", "setFullSignalWithICMinMax", "(", "String", "ICValue", ",", "String", "minValue", ",", "String", "maxValue", ")", "{", "_fs", "=", "null", ";", "Element", "theDesc1", "=", "new", "Element", "(", "\"description\"", ")", ";", "theDesc1", ".", "addContent", "(", "\"\"", ")", ";", "Element", "varDef", ";", "varDef", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "varDef", ".", "setAttribute", "(", "\"name\"", ",", "\"theVar\"", ")", ";", "varDef", ".", "setAttribute", "(", "\"varID\"", ",", "\"dv\"", ")", ";", "varDef", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "if", "(", "ICValue", "!=", "null", ")", "varDef", ".", "setAttribute", "(", "\"initialValue\"", ",", "ICValue", ")", ";", "if", "(", "minValue", "!=", "null", ")", "varDef", ".", "setAttribute", "(", "\"minValue\"", ",", "minValue", ")", ";", "if", "(", "maxValue", "!=", "null", ")", "varDef", ".", "setAttribute", "(", "\"maxValue\"", ",", "maxValue", ")", ";", "varDef", ".", "addContent", "(", "theDesc1", ")", ";", "varDef", ".", "addContent", "(", "new", "Element", "(", "\"isOutput\"", ")", ")", ";", "_fs", "=", "new", "Signal", "(", "varDef", ",", "_m", ")", ";", "assertEquals", "(", "\"theVar\"", ",", "_fs", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"dv\"", ",", "_fs", ".", "getVarID", "(", ")", ")", ";", "assertEquals", "(", "\"deg\"", ",", "_fs", ".", "getUnits", "(", ")", ")", ";", "assertTrue", "(", "_fs", ".", "getSource", "(", ")", "==", "null", ")", ";", "assertTrue", "(", "_fs", ".", "getSourcePort", "(", ")", "==", "0", ")", ";", "assertFalse", "(", "_fs", ".", "hasSource", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "hasDest", "(", ")", ")", ";", "assertFalse", "(", "_fs", ".", "isDerived", "(", ")", ")", ";", "_m", ".", "hookUpIO", "(", ")", ";", "try", "{", "_m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "SignalTest", ".", "class", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,416
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "junit", ".", "Before", ";", "import", "org", ".", "junit", ".", "AfterClass", ";", "import", "org", ".", "junit", ".", "BeforeClass", ";", "import", "org", ".", "junit", ".", "Test", ";", "import", "static", "org", ".", "junit", ".", "Assert", ".", "*", ";", "public", "class", "CodeAndVarNamesTest", "{", "CodeAndVarNames", "cvn0", ",", "cvn1", ",", "cvn2", ";", "public", "CodeAndVarNamesTest", "(", ")", "{", "}", "@", "BeforeClass", "public", "static", "void", "setUpClass", "(", ")", "throws", "Exception", "{", "}", "@", "AfterClass", "public", "static", "void", "tearDownClass", "(", ")", "throws", "Exception", "{", "}", "@", "Before", "public", "void", "setUp", "(", ")", "{", "cvn0", "=", "new", "CodeAndVarNames", "(", ")", ";", "cvn1", "=", "new", "CodeAndVarNames", "(", "\"\"", ")", ";", "cvn1", ".", "addVarName", "(", "\"alpha\"", ")", ";", "cvn2", "=", "new", "CodeAndVarNames", "(", "\"\"", ")", ";", "cvn2", ".", "addVarName", "(", "\"beta\"", ")", ";", "}", "@", "Test", "public", "void", "testAppend", "(", ")", "{", "cvn1", ".", "append", "(", "cvn2", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn1", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn2", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "cvn0", ".", "append", "(", "cvn1", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn0", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "cvn0", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn0", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn0", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn1", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn2", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "testAppendCode", "(", ")", "{", "cvn1", ".", "appendCode", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "testPrependCode", "(", ")", "{", "cvn1", ".", "prependCode", "(", "\"\"", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "testAddVarName", "(", ")", "{", "cvn1", ".", "addVarName", "(", "\"beta\"", ")", ";", "assertEquals", "(", "2", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn1", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "}", "@", "Test", "public", "void", "testGetVarNames", "(", ")", "{", "ArrayList", "<", "String", ">", "varNames", ";", "varNames", "=", "cvn0", ".", "getVarNames", "(", ")", ";", "assertNotNull", "(", "varNames", ")", ";", "assertEquals", "(", "0", ",", "varNames", ".", "size", "(", ")", ")", ";", "varNames", "=", "cvn1", ".", "getVarNames", "(", ")", ";", "assertEquals", "(", "1", ",", "varNames", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "varNames", ".", "get", "(", "0", ")", ")", ";", "varNames", "=", "cvn2", ".", "getVarNames", "(", ")", ";", "assertEquals", "(", "1", ",", "varNames", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "varNames", ".", "get", "(", "0", ")", ")", ";", "}", "@", "Test", "(", "expected", "=", "IndexOutOfBoundsException", ".", "class", ")", "public", "void", "testGetVarName", "(", ")", "{", "assertEquals", "(", "1", ",", "cvn1", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "cvn1", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "1", ",", "cvn2", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "cvn2", ".", "getVarName", "(", "0", ")", ")", ";", "String", "varName", "=", "cvn1", ".", "getVarName", "(", "1", ")", ";", "}", "@", "Test", "public", "void", "testGetCode", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "cvn0", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn1", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn2", ".", "getCode", "(", ")", ")", ";", "}", "}", "</s>" ]
8,417
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathSwitchTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "private", "StringWriter", "_writer", ";", "protected", "BlockMathSwitch", "_block", ";", "protected", "BlockMathConstant", "_inputBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_block", "=", "generateSampleSwitch", "(", "_model", ")", ";", "SignalArrayList", "theSignals", "=", "_model", ".", "getSignals", "(", ")", ";", "Signal", "inputSignal", "=", "theSignals", ".", "findByID", "(", "\"switchVal\"", ")", ";", "assertNotNull", "(", "inputSignal", ")", ";", "Block", "theBlock", "=", "inputSignal", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "theBlock", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "myType", ")", ";", "_inputBlock", "=", "(", "BlockMathConstant", ")", "theBlock", ";", "assertNotNull", "(", "_inputBlock", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "assertNotNull", "(", "_block", ")", ";", "String", "routineName", "=", "\"\"", ";", "_model", ".", "wireBlocks", "(", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "99.", ")", ")", ";", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "1.", ")", ")", ";", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "0.000001", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "-", "0.0", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "0.0", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "0.0", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "0.000001", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "1.", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "99.", ")", ")", ";", "}", "private", "double", "checkSwitch", "(", "Double", "switchVal", ")", "{", "String", "routineName", "=", "\"\"", ";", "_inputBlock", ".", "setValue", "(", "switchVal", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"", "for", "[\"", "+", "switchVal", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "_block", ".", "getValue", "(", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"}n\"", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "code", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"ENDIFn\"", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "code", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "private", "BlockMathSwitch", "generateSampleSwitch", "(", "Model", "model", ")", "{", "Block", "swValueBlock", ";", "String", "swValueSignalID", ";", "Signal", "swValueSignal", ";", "Signal", "outputSignal", ";", "swValueBlock", "=", "new", "BlockMathConstant", "(", "\"99\"", ",", "model", ")", ";", "swValueSignalID", "=", "\"switchVal\"", ";", "swValueSignal", "=", "new", "Signal", "(", "\"switch", "value\"", ",", "swValueSignalID", ",", "\"nd\"", ",", "1", ",", "model", ")", ";", "try", "{", "swValueBlock", ".", "addOutput", "(", "swValueSignal", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "model", ")", ";", "Element", "swValue", "=", "new", "Element", "(", "\"ci\"", ")", ";", "swValue", ".", "addContent", "(", "\"switchVal\"", ")", ";", "Element", "zero", "=", "new", "Element", "(", "\"cn\"", ")", ";", "zero", ".", "addContent", "(", "\"0\"", ")", ";", "Element", "lt", "=", "new", "Element", "(", "\"lt\"", ")", ";", "Element", "innerApply", "=", "new", "Element", "(", "\"apply\"", ")", ";", "innerApply", ".", "addContent", "(", "lt", ")", ";", "innerApply", ".", "addContent", "(", "swValue", ")", ";", "innerApply", ".", "addContent", "(", "zero", ")", ";", "Element", "minusOne", "=", "new", "Element", "(", "\"cn\"", ")", ";", "minusOne", ".", "addContent", "(", "\"-1\"", ")", ";", "Element", "piece", "=", "new", "Element", "(", "\"piece\"", ")", ";", "piece", ".", "addContent", "(", "minusOne", ")", ";", "piece", ".", "addContent", "(", "innerApply", ")", ";", "Element", "one", "=", "new", "Element", "(", "\"cn\"", ")", ";", "one", ".", "addContent", "(", "\"1\"", ")", ";", "Element", "otherwise", "=", "new", "Element", "(", "\"otherwise\"", ")", ";", "otherwise", ".", "addContent", "(", "one", ")", ";", "Element", "piecewise", "=", "new", "Element", "(", "\"piecewise\"", ")", ";", "piecewise", ".", "addContent", "(", "piece", ")", ";", "piecewise", ".", "addContent", "(", "otherwise", ")", ";", "Element", "outerApply", "=", "new", "Element", "(", "\"apply\"", ")", ";", "outerApply", ".", "addContent", "(", "piecewise", ")", ";", "BlockMathSwitch", "bms", "=", "null", ";", "bms", "=", "new", "BlockMathSwitch", "(", "outerApply", ",", "model", ")", ";", "try", "{", "bms", ".", "addOutput", "(", "outputSignal", ")", ";", "_model", ".", "wireBlocks", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "bms", ";", "}", "}", "</s>" ]
8,418
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathAbsTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "BlockMathAbs", "_block", ";", "private", "StringWriter", "_writer", ";", "protected", "Signal", "_sig", ",", "_outSig", ";", "protected", "BlockMathConstant", "_const", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "{", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "Element", "ciElement", "=", "new", "Element", "(", "\"ci\"", ")", ";", "ciElement", ".", "addContent", "(", "\"beta\"", ")", ";", "Element", "absElement", "=", "new", "Element", "(", "\"abs\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "absElement", ")", ";", "applyElement", ".", "addContent", "(", "ciElement", ")", ";", "_block", "=", "new", "BlockMathAbs", "(", "applyElement", ",", "_model", ")", ";", "_const", "=", "new", "BlockMathConstant", "(", "\"-3.45\"", ",", "_model", ")", ";", "Signal", "sig", "=", "new", "Signal", "(", "\"beta\"", ",", "_model", ")", ";", "_outSig", "=", "new", "Signal", "(", "\"absBeta\"", ",", "_model", ")", ";", "_block", ".", "addInput", "(", "sig", ",", "1", ")", ";", "try", "{", "_block", ".", "addOutput", "(", "_outSig", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_const", ".", "addOutput", "(", "sig", ")", ";", "}", "catch", "(", "DAVEException", "e2", ")", "{", "fail", "(", "\"\"", "+", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testBlockMathAbsCtor", "(", ")", "{", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "Element", "theValue", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue", ".", "addContent", "(", "\"fart\"", ")", ";", "Element", "absElement", "=", "new", "Element", "(", "\"abs\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "absElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue", ")", ";", "Block", "theBlock", "=", "new", "BlockMathAbs", "(", "applyElement", ",", "m", ")", ";", "assertTrue", "(", "theBlock", "!=", "null", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "theBlock", ".", "myName", ")", ";", "assertEquals", "(", "\"abs_1\"", ",", "theBlock", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "myType", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "getType", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "theBlock", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "theBlock", ".", "numVarIDs", "(", ")", ")", ";", "assertEquals", "(", "\"fart\"", ",", "theBlock", ".", "getVarID", "(", "1", ")", ")", ";", "assertFalse", "(", "theBlock", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "_const", ".", "setValue", "(", "4.56", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_block", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "4.56", ",", "_block", ".", "getValue", "(", ")", ",", "0.000001", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"absBeta\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"absBeta\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"beta\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "e", ".", "printStackTrace", "(", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "try", "{", "_block", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "3.45", ",", "_block", ".", "getValue", "(", ")", ",", "0.000001", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertFalse", "(", "_block", ".", "isReady", "(", ")", ")", ";", "try", "{", "_block", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertTrue", "(", "_block", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "silence", "(", ")", ";", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetModel", "(", ")", "{", "assertEquals", "(", "_model", ".", "getName", "(", ")", ",", "_block", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetSetName", "(", ")", "{", "assertEquals", "(", "\"abs_1\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "_block", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "_block", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarID", "(", ")", "{", "assertEquals", "(", "\"beta\"", ",", "_block", ".", "getVarID", "(", "1", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "Iterator", "<", "String", ">", "it", "=", "_block", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "String", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"beta\"", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutput", "(", ")", "{", "Signal", "s", "=", "_block", ".", "getOutput", "(", ")", ";", "assertEquals", "(", "_outSig", ",", "s", ")", ";", "}", "public", "void", "getGetInputIterator", "(", ")", "{", "Iterator", "<", "Signal", ">", "it", "=", "_block", ".", "getInputIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "Signal", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_sig", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"absBeta\"", ",", "_block", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "1", ",", "_block", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "1", ",", "_block", ".", "numVarIDs", "(", ")", ")", ";", "}", "}", "</s>" ]
8,419
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathMinmaxTest", "extends", "TestCase", "{", "protected", "Model", "modelMax", ",", "modelMin", ";", "private", "final", "double", "EPS", "=", "0.000001", ";", "protected", "BlockMathMinmax", "minBlock", ",", "maxBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "String", "routineName", "=", "\"\"", ";", "modelMin", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "modelMax", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "minBlock", "=", "setUpExtremaModel", "(", "\"min\"", ",", "routineName", ",", "modelMin", ")", ";", "maxBlock", "=", "setUpExtremaModel", "(", "\"max\"", ",", "routineName", ",", "modelMax", ")", ";", "}", "private", "BlockMathMinmax", "setUpExtremaModel", "(", "String", "op", ",", "String", "routineName", ",", "Model", "_model", ")", "throws", "Exception", "{", "Signal", "_outputSignal", ";", "Signal", "_value1Signal", ";", "Signal", "_value2Signal", ";", "String", "_value1SignalID", ";", "String", "_value2SignalID", ";", "BlockInput", "_input1Block", ";", "BlockInput", "_input2Block", ";", "BlockOutput", "_outputBlock", ";", "BlockMathMinmax", "_block", ";", "VectorInfoArrayList", "_inputVector", ";", "VectorInfoArrayList", "_outputVector", ";", "_value1SignalID", "=", "\"PB\"", ";", "_value2SignalID", "=", "\"BSPAN\"", ";", "_value1Signal", "=", "new", "Signal", "(", "\"PB\"", ",", "_value1SignalID", ",", "\"d_s\"", ",", "1", ",", "_model", ")", ";", "_value2Signal", "=", "new", "Signal", "(", "\"BSPAN\"", ",", "_value2SignalID", ",", "\"ft\"", ",", "1", ",", "_model", ")", ";", "_input1Block", "=", "new", "BlockInput", "(", "_value1Signal", ",", "_model", ")", ";", "_input2Block", "=", "new", "BlockInput", "(", "_value2Signal", ",", "_model", ")", ";", "_outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "_model", ")", ";", "_outputBlock", "=", "new", "BlockOutput", "(", "_outputSignal", ",", "_model", ")", ";", "Element", "theValue1", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue1", ".", "addContent", "(", "\"PB\"", ")", ";", "Element", "theValue2", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue2", ".", "addContent", "(", "\"BSPAN\"", ")", ";", "Element", "theMaxElement", "=", "new", "Element", "(", "op", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "theMaxElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue1", ")", ";", "applyElement", ".", "addContent", "(", "theValue2", ")", ";", "_block", "=", "new", "BlockMathMinmax", "(", "applyElement", ",", "_model", ")", ";", "_block", ".", "addInput", "(", "_value1Signal", ",", "1", ")", ";", "_block", ".", "addInput", "(", "_value2Signal", ",", "2", ")", ";", "_block", ".", "addOutput", "(", "_outputSignal", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "_inputVector", "=", "_model", ".", "getInputVector", "(", ")", ";", "assert", "(", "_inputVector", "!=", "null", ")", ";", "assertEquals", "(", "2", ",", "_inputVector", ".", "size", "(", ")", ")", ";", "VectorInfo", "_input1", "=", "_inputVector", ".", "get", "(", "0", ")", ";", "assert", "(", "_input1", "!=", "null", ")", ";", "_input1", ".", "setValue", "(", "\"2.0\"", ")", ";", "VectorInfo", "_input2", "=", "_inputVector", ".", "get", "(", "1", ")", ";", "assert", "(", "_input2", "!=", "null", ")", ";", "_input2", ".", "setValue", "(", "\"-3.5\"", ")", ";", "_model", ".", "hookUpIO", "(", ")", ";", "_outputVector", "=", "_model", ".", "getOutputVector", "(", ")", ";", "assert", "(", "_outputVector", "!=", "null", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"\"", "+", "op", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "_block", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "testDescribeSelf", "(", "\"max\"", ",", "maxBlock", ",", "\"2.0\"", ")", ";", "testDescribeSelf", "(", "\"min\"", ",", "minBlock", ",", "\"-3.5\"", ")", ";", "}", "private", "void", "testDescribeSelf", "(", "String", "op", ",", "BlockMathMinmax", "block", ",", "String", "valString", ")", "{", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "block", ".", "describeSelf", "(", "writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"Block", "\\\"\"", "+", "op", "+", "\"\"", "+", "\"\"", "+", "valString", "+", "\"\"", ",", "writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "assertEquals", "(", "2.0", ",", "maxBlock", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "assertEquals", "(", "-", "3.5", ",", "minBlock", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "maxBlock", ".", "isReady", "(", ")", ")", ";", "assertTrue", "(", "minBlock", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "maxBlock", ".", "allInputsReady", "(", ")", ")", ";", "assertTrue", "(", "minBlock", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "maxBlock", ".", "isVerbose", "(", ")", ")", ";", "maxBlock", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "maxBlock", ".", "isVerbose", "(", ")", ")", ";", "maxBlock", ".", "silence", "(", ")", ";", "assertFalse", "(", "maxBlock", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetName", "(", ")", "{", "assertEquals", "(", "\"max_4\"", ",", "maxBlock", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"min_4\"", ",", "minBlock", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "maxBlock", ".", "getType", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "minBlock", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarID", "(", ")", "{", "assertEquals", "(", "\"PB\"", ",", "maxBlock", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "maxBlock", ".", "getVarID", "(", "2", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "String", "name", ";", "Iterator", "<", "String", ">", "it", "=", "maxBlock", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"PB\"", ",", "name", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "name", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"outputSignal\"", ",", "maxBlock", ".", "getOutputVarID", "(", ")", ")", ";", "assertEquals", "(", "\"outputSignal\"", ",", "minBlock", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testSetName", "(", ")", "{", "maxBlock", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "maxBlock", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "2", ",", "maxBlock", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "minBlock", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "2", ",", "maxBlock", ".", "numVarIDs", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "minBlock", ".", "numVarIDs", "(", ")", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "String", "routineName", "=", "\"\"", ";", "checkMax", "(", "modelMax", ",", "0.", ",", "0.", ",", "routineName", ")", ";", "checkMax", "(", "modelMax", ",", "0.", ",", "-", "1.", ",", "routineName", ")", ";", "checkMax", "(", "modelMax", ",", "0.", ",", "-", "1.01", ",", "routineName", ")", ";", "checkMax", "(", "modelMax", ",", "0.", ",", "1.01", ",", "routineName", ")", ";", "checkMax", "(", "modelMax", ",", "-", "9.", ",", "-", "1.", ",", "routineName", ")", ";", "checkMin", "(", "modelMin", ",", "0.", ",", "0.", ",", "routineName", ")", ";", "checkMin", "(", "modelMin", ",", "0.", ",", "-", "1.", ",", "routineName", ")", ";", "checkMin", "(", "modelMin", ",", "0.", ",", "-", "1.01", ",", "routineName", ")", ";", "checkMin", "(", "modelMin", ",", "0.", ",", "1.01", ",", "routineName", ")", ";", "checkMin", "(", "modelMin", ",", "-", "9.", ",", "-", "1.", ",", "routineName", ")", ";", "}", "private", "void", "checkMax", "(", "Model", "model", ",", "Double", "n1", ",", "Double", "n2", ",", "String", "callingName", ")", "{", "String", "routineName", "=", "callingName", "+", "\"::checkMax()\"", ";", "VectorInfoArrayList", "inputs", "=", "null", ";", "try", "{", "inputs", "=", "model", ".", "getInputVector", "(", ")", ";", "Iterator", "<", "VectorInfo", ">", "it", "=", "inputs", ".", "iterator", "(", ")", ";", "VectorInfo", "input1", "=", "it", ".", "next", "(", ")", ";", "VectorInfo", "input2", "=", "it", ".", "next", "(", ")", ";", "input1", ".", "setValue", "(", "n1", ")", ";", "input2", ".", "setValue", "(", "n2", ")", ";", "try", "{", "model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"", "for", "max(\"", "+", "n1", ".", "toString", "(", ")", "+", "\",", "\"", "+", "n2", ".", "toString", "(", ")", "+", "\"]):", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "VectorInfoArrayList", "outputs", "=", "model", ".", "getOutputVector", "(", ")", ";", "it", "=", "outputs", ".", "iterator", "(", ")", ";", "VectorInfo", "output", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "Math", ".", "max", "(", "n1", ",", "n2", ")", ",", "output", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "private", "void", "checkMin", "(", "Model", "model", ",", "Double", "n1", ",", "Double", "n2", ",", "String", "callingName", ")", "{", "String", "routineName", "=", "callingName", "+", "\"::checkMin()\"", ";", "VectorInfoArrayList", "inputs", "=", "null", ";", "try", "{", "inputs", "=", "model", ".", "getInputVector", "(", ")", ";", "Iterator", "<", "VectorInfo", ">", "it", "=", "inputs", ".", "iterator", "(", ")", ";", "VectorInfo", "input1", "=", "it", ".", "next", "(", ")", ";", "VectorInfo", "input2", "=", "it", ".", "next", "(", ")", ";", "input1", ".", "setValue", "(", "n1", ")", ";", "input2", ".", "setValue", "(", "n2", ")", ";", "try", "{", "model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"", "for", "min(\"", "+", "n1", ".", "toString", "(", ")", "+", "\",", "\"", "+", "n2", ".", "toString", "(", ")", "+", "\"]):", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "VectorInfoArrayList", "outputs", "=", "model", ".", "getOutputVector", "(", ")", ";", "it", "=", "outputs", ".", "iterator", "(", ")", ";", "VectorInfo", "output", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "Math", ".", "min", "(", "n1", ",", "n2", ")", ",", "output", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
8,420
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "junit", ".", "framework", ".", "*", ";", "public", "class", "BlockArrayListTest", "extends", "TestCase", "{", "private", "Signal", "_fs", ";", "private", "BlockInput", "_bi", ";", "private", "BlockMathConstant", "_b1", ";", "private", "BlockMathConstant", "_b2", ";", "private", "BlockMathConstant", "_b3", ";", "private", "Model", "_m", ";", "private", "BlockArrayList", "_bal", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "_m", "=", "new", "Model", "(", "2", ",", "2", ")", ";", "_fs", "=", "new", "Signal", "(", ")", ";", "_bi", "=", "new", "BlockInput", "(", "_fs", ",", "_m", ")", ";", "_b1", "=", "new", "BlockMathConstant", "(", "\"1\"", ",", "_m", ")", ";", "_b2", "=", "new", "BlockMathConstant", "(", "\"2\"", ",", "_m", ")", ";", "_b3", "=", "new", "BlockMathConstant", "(", "\"3\"", ",", "_m", ")", ";", "_bal", "=", "new", "BlockArrayList", "(", "3", ")", ";", "}", "public", "void", "testConstructor", "(", ")", "throws", "Exception", "{", "assertEquals", "(", "0", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "isEmpty", "(", ")", ")", ";", "try", "{", "_bal", ".", "get", "(", "0", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "public", "void", "testAddToList", "(", ")", "{", "_bal", ".", "add", "(", "_b1", ")", ";", "assertEquals", "(", "1", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b1", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_b2", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_b3", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "0", ")", ")", ";", "try", "{", "_bal", ".", "get", "(", "1", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "try", "{", "_bal", ".", "get", "(", "2", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "_bal", ".", "add", "(", "_b2", ")", ";", "assertEquals", "(", "2", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b1", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b2", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_b3", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "_b2", ",", "_bal", ".", "get", "(", "1", ")", ")", ";", "try", "{", "_bal", ".", "get", "(", "2", ")", ";", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "_bal", ".", "add", "(", "_b3", ")", ";", "assertEquals", "(", "3", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b1", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b2", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b3", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_bi", ")", ")", ";", "assertEquals", "(", "0", ",", "_bal", ".", "indexOf", "(", "_b1", ")", ")", ";", "assertEquals", "(", "1", ",", "_bal", ".", "indexOf", "(", "_b2", ")", ")", ";", "assertEquals", "(", "2", ",", "_bal", ".", "indexOf", "(", "_b3", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "_b2", ",", "_bal", ".", "get", "(", "1", ")", ")", ";", "assertEquals", "(", "_b3", ",", "_bal", ".", "get", "(", "2", ")", ")", ";", "}", "public", "void", "testAdd4BlkTo3BlkList", "(", ")", "{", "_bal", ".", "add", "(", "_b1", ")", ";", "_bal", ".", "add", "(", "_b2", ")", ";", "_bal", ".", "add", "(", "_b3", ")", ";", "_bal", ".", "add", "(", "_bi", ")", ";", "assertEquals", "(", "4", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b1", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b2", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b3", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_bi", ")", ")", ";", "assertEquals", "(", "0", ",", "_bal", ".", "indexOf", "(", "_b1", ")", ")", ";", "assertEquals", "(", "1", ",", "_bal", ".", "indexOf", "(", "_b2", ")", ")", ";", "assertEquals", "(", "2", ",", "_bal", ".", "indexOf", "(", "_b3", ")", ")", ";", "assertEquals", "(", "3", ",", "_bal", ".", "indexOf", "(", "_bi", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "_b2", ",", "_bal", ".", "get", "(", "1", ")", ")", ";", "assertEquals", "(", "_b3", ",", "_bal", ".", "get", "(", "2", ")", ")", ";", "assertEquals", "(", "_bi", ",", "_bal", ".", "get", "(", "3", ")", ")", ";", "}", "public", "void", "testAddDuptoBlkList", "(", ")", "{", "_bal", ".", "add", "(", "_b1", ")", ";", "_bal", ".", "add", "(", "_b2", ")", ";", "_bal", ".", "add", "(", "_b1", ")", ";", "_bal", ".", "add", "(", "_b2", ")", ";", "assertEquals", "(", "4", ",", "_bal", ".", "size", "(", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b1", ")", ")", ";", "assertTrue", "(", "_bal", ".", "contains", "(", "_b2", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_b3", ")", ")", ";", "assertFalse", "(", "_bal", ".", "contains", "(", "_bi", ")", ")", ";", "assertEquals", "(", "0", ",", "_bal", ".", "indexOf", "(", "_b1", ")", ")", ";", "assertEquals", "(", "1", ",", "_bal", ".", "indexOf", "(", "_b2", ")", ")", ";", "assertEquals", "(", "2", ",", "_bal", ".", "lastIndexOf", "(", "_b1", ")", ")", ";", "assertEquals", "(", "3", ",", "_bal", ".", "lastIndexOf", "(", "_b2", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "0", ")", ")", ";", "assertEquals", "(", "_b2", ",", "_bal", ".", "get", "(", "1", ")", ")", ";", "assertEquals", "(", "_b1", ",", "_bal", ".", "get", "(", "2", ")", ")", ";", "assertEquals", "(", "_b2", ",", "_bal", ".", "get", "(", "3", ")", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "BlockArrayListTest", ".", "class", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,421
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "ParseTextTest", "extends", "TestCase", "{", "protected", "final", "double", "EPS", "=", "0.000000001", ";", "protected", "ParseText", "pt", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "pt", "=", "new", "ParseText", "(", "\"\"", ")", ";", "}", "public", "void", "testNext", "(", ")", "{", "try", "{", "assertEquals", "(", "-", "4.", ",", "pt", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertFalse", "(", "pt", ".", "eof", "(", ")", ")", ";", "assertTrue", "(", "pt", ".", "validNumber", "(", ")", ")", ";", "try", "{", "assertEquals", "(", "5.555", ",", "pt", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertFalse", "(", "pt", ".", "eof", "(", ")", ")", ";", "assertTrue", "(", "pt", ".", "validNumber", "(", ")", ")", ";", "try", "{", "assertEquals", "(", "6.6E-6", ",", "pt", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertFalse", "(", "pt", ".", "eof", "(", ")", ")", ";", "assertTrue", "(", "pt", ".", "validNumber", "(", ")", ")", ";", "try", "{", "assertEquals", "(", "345.", ",", "pt", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertFalse", "(", "pt", ".", "eof", "(", ")", ")", ";", "assertTrue", "(", "pt", ".", "validNumber", "(", ")", ")", ";", "try", "{", "assertEquals", "(", "Double", ".", "NaN", ",", "pt", ".", "next", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertTrue", "(", "pt", ".", "eof", "(", ")", ")", ";", "assertFalse", "(", "pt", ".", "validNumber", "(", ")", ")", ";", "}", "public", "void", "testBadList1", "(", ")", "{", "double", "value", "=", "0", ";", "ParseText", "badList", "=", "new", "ParseText", "(", "\"-4-6.5\"", ")", ";", "assertNotNull", "(", "badList", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "Double", ".", "NaN", ",", "value", ")", ";", "assertFalse", "(", "badList", ".", "goodNumber", ")", ";", "assertFalse", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertTrue", "(", "badList", ".", "eof", "(", ")", ")", ";", "}", "public", "void", "testBadList2", "(", ")", "{", "double", "value", "=", "0", ";", "ParseText", "badList", "=", "new", "ParseText", "(", "\"4.6.5\"", ")", ";", "assertNotNull", "(", "badList", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "Double", ".", "NaN", ",", "value", ")", ";", "assertFalse", "(", "badList", ".", "goodNumber", ")", ";", "assertFalse", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertTrue", "(", "badList", ".", "eof", "(", ")", ")", ";", "}", "public", "void", "testBadList3", "(", ")", "{", "double", "value", "=", "0", ";", "ParseText", "badList", "=", "new", "ParseText", "(", "\"4E6e5\"", ")", ";", "assertNotNull", "(", "badList", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "Double", ".", "NaN", ",", "value", ")", ";", "assertFalse", "(", "badList", ".", "goodNumber", ")", ";", "assertFalse", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertTrue", "(", "badList", ".", "eof", "(", ")", ")", ";", "}", "public", "void", "testBadList4", "(", ")", "{", "double", "value", "=", "0", ";", "ParseText", "badList", "=", "new", "ParseText", "(", "\"3.32,4E6e5\"", ")", ";", "assertNotNull", "(", "badList", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "3.32", ",", "value", ")", ";", "assertTrue", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertFalse", "(", "badList", ".", "eof", "(", ")", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "Double", ".", "NaN", ",", "value", ")", ";", "assertFalse", "(", "badList", ".", "goodNumber", ")", ";", "assertFalse", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertTrue", "(", "badList", ".", "eof", "(", ")", ")", ";", "}", "public", "void", "testBadList5", "(", ")", "{", "double", "value", "=", "0", ";", "ParseText", "badList", "=", "new", "ParseText", "(", "\"4E6e5,3.32\"", ")", ";", "assertNotNull", "(", "badList", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "3.32", ",", "value", ")", ";", "assertTrue", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertFalse", "(", "badList", ".", "eof", "(", ")", ")", ";", "try", "{", "value", "=", "badList", ".", "next", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "Double", ".", "NaN", ",", "value", ")", ";", "assertFalse", "(", "badList", ".", "goodNumber", ")", ";", "assertFalse", "(", "badList", ".", "validNumber", "(", ")", ")", ";", "assertTrue", "(", "badList", ".", "eof", "(", ")", ")", ";", "}", "public", "void", "testToList", "(", ")", "{", "ArrayList", "<", "Double", ">", "theList", "=", "null", ";", "try", "{", "theList", "=", "pt", ".", "toList", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertNotNull", "(", "theList", ")", ";", "Iterator", "<", "Double", ">", "it", "=", "theList", ".", "iterator", "(", ")", ";", "assertNotNull", "(", "it", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "-", "4.0", ",", "it", ".", "next", "(", ")", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "5.555", ",", "it", ".", "next", "(", ")", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "0.0000066", ",", "it", ".", "next", "(", ")", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "345.0", ",", "it", ".", "next", "(", ")", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testToListString", "(", ")", "{", "ArrayList", "<", "Double", ">", "answers", "=", "new", "ArrayList", "<", "Double", ">", "(", "2", ")", ";", "answers", ".", "add", "(", "-", "4.0", ")", ";", "answers", ".", "add", "(", "6.666", ")", ";", "compareStringToList", "(", "\"-4.,6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.0,", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.,t6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.t,6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.0", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4.t6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"#-4", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4", "#", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4#", "6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4", "#6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4#6.666\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"-4", "6.666#\"", ",", "answers", ")", ";", "answers", ".", "add", "(", "-", "5567.", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "compareStringToList", "(", "\"\"", ",", "answers", ")", ";", "}", "protected", "void", "compareStringToList", "(", "String", "string", ",", "ArrayList", "<", "Double", ">", "expectedValues", ")", "{", "ArrayList", "<", "Double", ">", "theList", "=", "null", ";", "try", "{", "theList", "=", "ParseText", ".", "toList", "(", "string", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "string", "+", "\"':", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "expectedValues", ".", "size", "(", ")", ",", "theList", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Double", ">", "it", "=", "theList", ".", "iterator", "(", ")", ";", "assertNotNull", "(", "it", ")", ";", "Iterator", "<", "Double", ">", "ev_it", "=", "expectedValues", ".", "iterator", "(", ")", ";", "while", "(", "ev_it", ".", "hasNext", "(", ")", ")", "{", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "assertEquals", "(", "ev_it", ".", "next", "(", ")", ",", "it", ".", "next", "(", ")", ",", "EPS", ")", ";", "}", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "}", "</s>" ]
8,422
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockBPTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "BreakpointSet", "_bps", ";", "protected", "BlockBP", "_bpb", ";", "protected", "Signal", "_inSig", ";", "protected", "Signal", "_outSig", ";", "protected", "BlockMathConstant", "_sourceBlock", ";", "private", "StringWriter", "_writer", ";", "private", "final", "Double", "EPS", "=", "0.000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_inSig", "=", "new", "Signal", "(", "\"inSig\"", ",", "_model", ")", ";", "_outSig", "=", "new", "Signal", "(", "\"outSig\"", ",", "_model", ")", ";", "_sourceBlock", "=", "new", "BlockMathConstant", "(", "\"32.15\"", ",", "_model", ")", ";", "_sourceBlock", ".", "addOutput", "(", "_inSig", ")", ";", "try", "{", "_bps", "=", "new", "BreakpointSet", "(", "\"alpha\"", ",", "\"ALPHA1\"", ",", "\"\"", ",", "\"\"", ",", "_model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_bpb", "=", "new", "BlockBP", "(", "\"ALPHA1\"", ",", "\"theBPblock\"", ",", "_inSig", ",", "_outSig", ",", "_model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testBlockBP", "(", ")", "{", "assertNotNull", "(", "_bpb", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "tryBPBupdate", "(", ")", ";", "assertEquals", "(", "8.43", ",", "_bpb", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "_sourceBlock", ".", "setValue", "(", "0.0", ")", ";", "tryBPBupdate", "(", ")", ";", "assertEquals", "(", "2.00", ",", "_bpb", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "_sourceBlock", ".", "setValue", "(", "-", "20.0", ")", ";", "tryBPBupdate", "(", ")", ";", "assertEquals", "(", "0.00", ",", "_bpb", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "_sourceBlock", ".", "setValue", "(", "200.0", ")", ";", "tryBPBupdate", "(", ")", ";", "assertEquals", "(", "11.00", ",", "_bpb", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testGetBPID", "(", ")", "{", "assertEquals", "(", "\"ALPHA1\"", ",", "_bpb", ".", "getBPID", "(", ")", ")", ";", "}", "public", "void", "testLength", "(", ")", "{", "assertEquals", "(", "12", ",", "_bpb", ".", "length", "(", ")", ")", ";", "}", "public", "void", "testGetBPset", "(", ")", "{", "assertEquals", "(", "_bps", ",", "_bpb", ".", "getBPset", "(", ")", ")", ";", "}", "public", "void", "testDescribeSelfFileWriter", "(", ")", "{", "try", "{", "_bpb", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "protected", "void", "tryBPBupdate", "(", ")", "{", "try", "{", "_bpb", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "</s>" ]
8,423
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "VectorInfoArrayListTest", "extends", "TestCase", "{", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "}", "public", "void", "testVectorInfoArrayList", "(", ")", "{", "VectorInfoArrayList", "vial", "=", "new", "VectorInfoArrayList", "(", ")", ";", "assertNotNull", "(", "vial", ")", ";", "}", "public", "void", "testVectorInfoArrayListInt", "(", ")", "{", "VectorInfoArrayList", "vial", "=", "new", "VectorInfoArrayList", "(", "50", ")", ";", "assertNotNull", "(", "vial", ")", ";", "}", "public", "void", "testVectorInfoArrayListCollectionOfVectorInfo", "(", ")", "{", "VectorInfo", "vi1", "=", "new", "VectorInfo", "(", "\"alpha\"", ",", "\"deg\"", ",", "null", ",", "false", ")", ";", "VectorInfo", "vi2", "=", "new", "VectorInfo", "(", "\"beta\"", ",", "\"deg\"", ",", "null", ",", "false", ")", ";", "VectorInfo", "vi3", "=", "new", "VectorInfo", "(", "\"gamma\"", ",", "\"deg\"", ",", "null", ",", "false", ")", ";", "Collection", "<", "VectorInfo", ">", "c", "=", "Arrays", ".", "asList", "(", "vi1", ",", "vi2", ",", "vi3", ")", ";", "VectorInfoArrayList", "vial", "=", "new", "VectorInfoArrayList", "(", "c", ")", ";", "assertNotNull", "(", "vial", ")", ";", "assertEquals", "(", "3", ",", "vial", ".", "size", "(", ")", ")", ";", "VectorInfo", "vi", "=", "vial", ".", "get", "(", "0", ")", ";", "assertNotNull", "(", "vi", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "vi", ".", "getName", "(", ")", ")", ";", "vi", "=", "vial", ".", "get", "(", "1", ")", ";", "assertNotNull", "(", "vi", ")", ";", "assertEquals", "(", "\"beta\"", ",", "vi", ".", "getName", "(", ")", ")", ";", "vi", "=", "vial", ".", "get", "(", "2", ")", ";", "assertNotNull", "(", "vi", ")", ";", "assertEquals", "(", "\"gamma\"", ",", "vi", ".", "getName", "(", ")", ")", ";", "}", "}", "</s>" ]
8,424
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "junit", ".", "framework", ".", "*", ";", "public", "class", "ModelTest", "extends", "TestCase", "{", "Model", "_simple", ";", "protected", "void", "setUp", "(", ")", "{", "_simple", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "}", "public", "void", "testName", "(", ")", "{", "assertTrue", "(", "_simple", ".", "getName", "(", ")", "==", "\"untitled\"", ")", ";", "_simple", ".", "setName", "(", "\"test", "name\"", ")", ";", "assertTrue", "(", "_simple", ".", "getName", "(", ")", "==", "\"test", "name\"", ")", ";", "}", "public", "void", "testCycleCounter", "(", ")", "{", "assertTrue", "(", "_simple", ".", "getCycleCounter", "(", ")", "==", "0", ")", ";", "_simple", ".", "incrementCycleCounter", "(", ")", ";", "assertTrue", "(", "_simple", ".", "getCycleCounter", "(", ")", "==", "1", ")", ";", "_simple", ".", "resetCycleCounter", "(", ")", ";", "assertTrue", "(", "_simple", ".", "getCycleCounter", "(", ")", "==", "0", ")", ";", "}", "public", "void", "testVerboseFlag", "(", ")", "{", "assertFalse", "(", "_simple", ".", "isVerbose", "(", ")", ")", ";", "_simple", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_simple", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testAddBlocks", "(", ")", "{", "Signal", "s", "=", "new", "Signal", "(", "\"sig\"", ",", "_simple", ")", ";", "assertTrue", "(", "_simple", ".", "getNumInputBlocks", "(", ")", "==", "0", ")", ";", "assertTrue", "(", "_simple", ".", "getNumOutputBlocks", "(", ")", "==", "0", ")", ";", "new", "BlockInput", "(", "s", ",", "_simple", ")", ";", "assertTrue", "(", "_simple", ".", "getNumInputBlocks", "(", ")", "==", "1", ")", ";", "assertTrue", "(", "_simple", ".", "getNumOutputBlocks", "(", ")", "==", "0", ")", ";", "new", "BlockOutput", "(", "s", ",", "_simple", ")", ";", "assertTrue", "(", "_simple", ".", "getNumInputBlocks", "(", ")", "==", "1", ")", ";", "assertTrue", "(", "_simple", ".", "getNumOutputBlocks", "(", ")", "==", "1", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "ModelTest", ".", "class", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,425
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockFuncTableTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "BreakpointSet", "_bpAlpha1", ";", "protected", "BreakpointSet", "_bpDe1", ";", "protected", "BlockBP", "_alpha1BpBlock", ";", "protected", "BlockBP", "_de1BpBlock", ";", "protected", "Signal", "_alphaSig", ";", "protected", "Signal", "_deSig", ";", "protected", "Signal", "_alphaIndexOffsetSig", ";", "protected", "Signal", "_deIndexOffsetSig", ";", "protected", "Signal", "_cmtSig", ";", "protected", "BlockMathConstant", "_alphaSourceBlock", ";", "protected", "BlockMathConstant", "_deSourceBlock", ";", "protected", "BlockFuncTable", "_bft", ";", "private", "StringWriter", "_writer", ";", "private", "final", "Double", "EPS", "=", "0.000001", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_alphaSig", "=", "new", "Signal", "(", "\"alpha\"", ",", "_model", ")", ";", "_deSig", "=", "new", "Signal", "(", "\"el\"", ",", "_model", ")", ";", "_cmtSig", "=", "new", "Signal", "(", "\"cmt\"", ",", "_model", ")", ";", "_alphaSourceBlock", "=", "new", "BlockMathConstant", "(", "\"12.15\"", ",", "_model", ")", ";", "_deSourceBlock", "=", "new", "BlockMathConstant", "(", "\"0.25\"", ",", "_model", ")", ";", "_alphaSourceBlock", ".", "addOutput", "(", "_alphaSig", ")", ";", "_deSourceBlock", ".", "addOutput", "(", "_deSig", ")", ";", "_bpAlpha1", "=", "BreakpointSetTest", ".", "generateSampleAlphaBreakpointSet", "(", "_model", ")", ";", "_bpDe1", "=", "BreakpointSetTest", ".", "generateSampleElevBreakpointSet", "(", "_model", ")", ";", "Element", "functionElement", "=", "generateExampleBlockFuncTableDOM", "(", ")", ";", "_bft", "=", "new", "BlockFuncTable", "(", "functionElement", ",", "_model", ")", ";", "_deIndexOffsetSig", "=", "_bft", ".", "getInput", "(", "0", ")", ";", "_alphaIndexOffsetSig", "=", "_bft", ".", "getInput", "(", "1", ")", ";", "_de1BpBlock", "=", "(", "BlockBP", ")", "_deIndexOffsetSig", ".", "getSource", "(", ")", ";", "_alpha1BpBlock", "=", "(", "BlockBP", ")", "_alphaIndexOffsetSig", ".", "getSource", "(", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "assertTrue", "(", "_bft", ".", "isReady", "(", ")", ")", ";", "try", "{", "_bft", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e2", ")", "{", "fail", "(", "\"\"", "+", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "-", "0.0015839583", ",", "_bft", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "checkFuncValue", "(", "-", "10.", ",", "-", "24.", ",", "0.205", ")", ";", "checkFuncValue", "(", "45.", ",", "-", "24.", ",", "0.192", ")", ";", "checkFuncValue", "(", "-", "10.", ",", "24.", ",", "-", "0.259", ")", ";", "checkFuncValue", "(", "45.", ",", "24.", ",", "-", "0.005", ")", ";", "checkFuncValue", "(", "0.", ",", "0.", ",", "-", "0.009", ")", ";", "checkFuncValue", "(", "5.0", ",", "0.", ",", "-", "0.005", ")", ";", "checkFuncValue", "(", "10.0", ",", "0.", ",", "-", "0.006", ")", ";", "checkFuncValue", "(", "5.0", ",", "12.", ",", "-", "0.127", ")", ";", "checkFuncValue", "(", "10.0", ",", "12.", ",", "-", "0.129", ")", ";", "checkFuncValue", "(", "7.1", ",", "0.", ",", "-", "0.00542", ")", ";", "checkFuncValue", "(", "7.1", ",", "12.", ",", "-", "0.12784", ")", ";", "checkFuncValue", "(", "7.1", ",", "5.43", ",", "-", "0.06081505", ")", ";", "}", "private", "void", "checkFuncValue", "(", "Double", "alpha", ",", "Double", "de", ",", "Double", "expectedValue", ")", "{", "_alphaSourceBlock", ".", "setValue", "(", "alpha", ")", ";", "_deSourceBlock", ".", "setValue", "(", "de", ")", ";", "try", "{", "_alpha1BpBlock", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_de1BpBlock", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e2", ")", "{", "fail", "(", "\"\"", "+", "e2", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_bft", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e3", ")", "{", "fail", "(", "\"\"", "+", "e3", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "expectedValue", ",", "_bft", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testBlockFuncTableElementModel", "(", ")", "{", "assertNotNull", "(", "_bft", ")", ";", "assertEquals", "(", "2", ",", "_bft", ".", "numInputs", "(", ")", ")", ";", "assertEquals", "(", "\"cmt\"", ",", "_bft", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testBlockFuncTableBlockFuncTable", "(", ")", "{", "}", "public", "void", "testGetFunctionTableDef", "(", ")", "{", "FuncTable", "gft", "=", "_bft", ".", "getFunctionTableDef", "(", ")", ";", "assertNotNull", "(", "gft", ")", ";", "}", "public", "void", "testParseSimpleFunction", "(", ")", "{", "}", "public", "void", "testPrintTableWriter", "(", ")", "{", "int", "expectedLines", "=", "5", ";", "int", "expectedLength", "=", "873", ";", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "StringBuffer", "buffer", ";", "String", "osName", "=", "System", ".", "getProperty", "(", "\"os.name\"", ")", ";", "assertNotNull", "(", "writer", ")", ";", "try", "{", "_bft", ".", "printTable", "(", "writer", ")", ";", "buffer", "=", "writer", ".", "getBuffer", "(", ")", ";", "if", "(", "osName", ".", "contains", "(", "\"Windows\"", ")", ")", "{", "expectedLength", "+=", "expectedLines", ";", "}", "assertEquals", "(", "expectedLength", ",", "buffer", ".", "length", "(", ")", ")", ";", "String", "[", "]", "lines", "=", "buffer", ".", "toString", "(", ")", ".", "split", "(", "System", ".", "getProperty", "(", "\"\"", ")", ")", ";", "assertEquals", "(", "expectedLines", ",", "lines", ".", "length", ")", ";", "assertNotNull", "(", "lines", "[", "0", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "0", "]", ")", ";", "assertNotNull", "(", "lines", "[", "1", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "1", "]", ")", ";", "assertNotNull", "(", "lines", "[", "2", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "2", "]", ")", ";", "assertNotNull", "(", "lines", "[", "3", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "3", "]", ")", ";", "assertNotNull", "(", "lines", "[", "4", "]", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", ",", "lines", "[", "4", "]", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testGetDescription", "(", ")", "{", "String", "descr", "=", "_bft", ".", "getDescription", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "descr", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "{", "try", "{", "_bft", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "String", "str", "=", "_writer", ".", "toString", "(", ")", ";", "assertNotNull", "(", "str", ")", ";", "assertEquals", "(", "141", ",", "str", ".", "length", "(", ")", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "str", ")", ";", "}", "public", "static", "Element", "generateExampleBlockFuncTableDOM", "(", ")", "{", "Element", "griddedTableDef", "=", "FuncTableTest", ".", "generateSampleGriddedTableDefDOM", "(", ")", ";", "Element", "funcDefn", "=", "new", "Element", "(", "\"functionDefn\"", ")", ";", "funcDefn", ".", "setAttribute", "(", "\"name\"", ",", "\"Cm0_fn\"", ")", ";", "funcDefn", ".", "addContent", "(", "griddedTableDef", ")", ";", "Element", "iVarRef1", "=", "new", "Element", "(", "\"\"", ")", ";", "iVarRef1", ".", "setAttribute", "(", "\"varID\"", ",", "\"el\"", ")", ";", "iVarRef1", ".", "setAttribute", "(", "\"min\"", ",", "\"-24.0\"", ")", ";", "iVarRef1", ".", "setAttribute", "(", "\"max\"", ",", "\"24.0\"", ")", ";", "iVarRef1", ".", "setAttribute", "(", "\"extrapolate\"", ",", "\"neither\"", ")", ";", "Element", "iVarRef2", "=", "new", "Element", "(", "\"\"", ")", ";", "iVarRef2", ".", "setAttribute", "(", "\"varID\"", ",", "\"alpha\"", ")", ";", "iVarRef2", ".", "setAttribute", "(", "\"min\"", ",", "\"-10.0\"", ")", ";", "iVarRef2", ".", "setAttribute", "(", "\"max\"", ",", "\"", "45.0\"", ")", ";", "iVarRef2", ".", "setAttribute", "(", "\"extrapolate\"", ",", "\"neither\"", ")", ";", "Element", "dVarRef", "=", "new", "Element", "(", "\"\"", ")", ";", "dVarRef", ".", "setAttribute", "(", "\"varID\"", ",", "\"cmt\"", ")", ";", "Element", "descriptionElement", "=", "new", "Element", "(", "\"description\"", ")", ";", "descriptionElement", ".", "addContent", "(", "\"\"", "+", "System", ".", "getProperty", "(", "\"\"", ")", "+", "\"\"", ")", ";", "Element", "functionElement", "=", "new", "Element", "(", "\"function\"", ")", ";", "functionElement", ".", "setAttribute", "(", "\"name\"", ",", "\"Basic", "Cm\"", ")", ";", "functionElement", ".", "addContent", "(", "descriptionElement", ")", ";", "functionElement", ".", "addContent", "(", "iVarRef1", ")", ";", "functionElement", ".", "addContent", "(", "iVarRef2", ")", ";", "functionElement", ".", "addContent", "(", "dVarRef", ")", ";", "functionElement", ".", "addContent", "(", "funcDefn", ")", ";", "return", "functionElement", ";", "}", "}", "</s>" ]
8,426
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathRelationTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "Signal", "_outputSignal", ";", "protected", "Signal", "_value1Signal", ";", "protected", "Signal", "_value2Signal", ";", "protected", "String", "_value1SignalID", ";", "protected", "String", "_value2SignalID", ";", "protected", "BlockMathConstant", "_value1Block", ";", "protected", "BlockMathConstant", "_value2Block", ";", "protected", "BlockMathRelation", "_block", ";", "private", "StringWriter", "_writer", ";", "protected", "String", "routineName", "=", "\"\"", ";", "private", "final", "double", "EPS", "=", "0.000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "String", "theRoutineName", "=", "\"\"", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_value1Block", "=", "new", "BlockMathConstant", "(", "\"-3.5\"", ",", "_model", ")", ";", "_value2Block", "=", "new", "BlockMathConstant", "(", "\"", "2.0\"", ",", "_model", ")", ";", "_value1SignalID", "=", "\"ALP_UNLIM\"", ";", "_value2SignalID", "=", "\"ALP_LIMIT\"", ";", "_value1Signal", "=", "new", "Signal", "(", "\"\"", ",", "_value1SignalID", ",", "\"d_s\"", ",", "1", ",", "_model", ")", ";", "_value2Signal", "=", "new", "Signal", "(", "\"alpha", "limit\"", ",", "_value2SignalID", ",", "\"ft\"", ",", "1", ",", "_model", ")", ";", "_value1Block", ".", "addOutput", "(", "_value1Signal", ")", ";", "_value2Block", ".", "addOutput", "(", "_value2Signal", ")", ";", "_outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "_model", ")", ";", "Element", "theValue1", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue1", ".", "addContent", "(", "\"ALP_UNLIM\"", ")", ";", "Element", "theValue2", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue2", ".", "addContent", "(", "\"ALP_LIMIT\"", ")", ";", "Element", "theTimesElement", "=", "new", "Element", "(", "\"lt\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "theTimesElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue1", ")", ";", "applyElement", ".", "addContent", "(", "theValue2", ")", ";", "_block", "=", "new", "BlockMathRelation", "(", "applyElement", ",", "_model", ")", ";", "_block", ".", "addInput", "(", "_value1Signal", ",", "1", ")", ";", "_block", ".", "addInput", "(", "_value2Signal", ",", "2", ")", ";", "_block", ".", "addOutput", "(", "_outputSignal", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "theRoutineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "final", "void", "testGetSetValidateUpdateRelation", "(", ")", "{", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"lt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"leq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"eq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "4.5", ",", "\"geq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "4.5", ",", "\"gt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "-", "4.5", ",", "\"lt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "-", "4.5", ",", "\"leq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"eq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"geq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"gt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"lt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"leq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"eq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"geq\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"gt\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"LT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"LEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "4.5", ",", "\"EQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "4.5", ",", "\"GEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "4.5", ",", "\"GT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "-", "4.5", ",", "\"LT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "-", "4.5", ",", "\"LEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"EQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"GEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "-", "4.5", ",", "\"GT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"LT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"lt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"LEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"leq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"EQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"eq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertTrue", "(", "checkRelation", "(", "2.0", ",", "\"GEQ\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"geq\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"GT\"", ",", "2.0", ",", "false", ")", ")", ";", "assertEquals", "(", "\"gt\"", ",", "_block", ".", "getRelationOp", "(", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"le\"", ",", "2.0", ",", "true", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"XX\"", ",", "2.0", ",", "true", ")", ")", ";", "assertFalse", "(", "checkRelation", "(", "2.0", ",", "\"--\"", ",", "2.0", ",", "true", ")", ")", ";", "}", "public", "final", "void", "testBlockMathRelation", "(", ")", "{", "assertNotNull", "(", "_block", ")", ";", "assertEquals", "(", "1", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "CodeAndVarNames", "cvn", ";", "String", "expected", ";", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "_block", ".", "getOutput", "(", ")", ".", "setDerivedFlag", "(", ")", ";", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "expected", "=", "\"\"", ";", "assertEquals", "(", "expected", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"ALP_UNLIM\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"ALP_LIMIT\"", ",", "cvn", ".", "getVarName", "(", "1", ")", ")", ";", "_block", ".", "getOutput", "(", ")", ".", "clearDerivedFlag", "(", ")", ";", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "expected", "=", "\"\"", "+", "expected", "+", "\";n\"", ";", "assertEquals", "(", "expected", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"outputSignal\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"ALP_UNLIM\"", ",", "cvn", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"ALP_LIMIT\"", ",", "cvn", ".", "getVarName", "(", "2", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "CodeAndVarNames", "cvn", ";", "String", "expected", ";", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "_block", ".", "getOutput", "(", ")", ".", "setDerivedFlag", "(", ")", ";", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "expected", "=", "\"\"", ";", "assertEquals", "(", "expected", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"ALP_UNLIM\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"ALP_LIMIT\"", ",", "cvn", ".", "getVarName", "(", "1", ")", ")", ";", "_block", ".", "getOutput", "(", ")", ".", "clearDerivedFlag", "(", ")", ";", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "expected", "=", "\"\"", "+", "expected", "+", "\"n\"", ";", "assertEquals", "(", "expected", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "3", ",", "cvn", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"outputSignal\"", ",", "cvn", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"ALP_UNLIM\"", ",", "cvn", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"ALP_LIMIT\"", ",", "cvn", ".", "getVarName", "(", "2", ")", ")", ";", "}", "public", "void", "testDescribeSelfFileWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "private", "boolean", "checkRelation", "(", "Double", "n1", ",", "String", "relation", ",", "Double", "n2", ",", "boolean", "expectException", ")", "{", "_value1Block", ".", "setValue", "(", "n1", ")", ";", "_value2Block", ".", "setValue", "(", "n2", ")", ";", "try", "{", "_block", ".", "setRelationOp", "(", "relation", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "if", "(", "!", "expectException", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"\"", "+", "n1", ".", "toString", "(", ")", "+", "\"", "\"", "+", "relation", "+", "\"", "\"", "+", "n2", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e1", ".", "getMessage", "(", ")", ")", ";", "}", "}", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"\"", "+", "n1", ".", "toString", "(", ")", "+", "\"", "\"", "+", "relation", "+", "\"", "\"", "+", "n2", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "(", "_block", ".", "getValue", "(", ")", "==", "1", ")", ";", "}", "}", "</s>" ]
8,427
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfo", ";", "public", "class", "VectorInfoTest", "extends", "TestCase", "{", "protected", "VectorInfo", "_vi", ";", "protected", "Model", "_model", ";", "protected", "VectorInfoArrayList", "_inputs", ";", "protected", "VectorInfoArrayList", "_outputs", ";", "private", "final", "double", "EPS", "=", "0.00000001", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_vi", "=", "new", "VectorInfo", "(", ")", ";", "_model", "=", "genSampleModel", "(", ")", ";", "_inputs", "=", "_model", ".", "getInputVector", "(", ")", ";", "_outputs", "=", "_model", ".", "getOutputVector", "(", ")", ";", "}", "public", "void", "testVectorInfo", "(", ")", "{", "assertNotNull", "(", "_vi", ")", ";", "assertEquals", "(", "\"\"", ",", "_vi", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "_vi", ".", "getUnits", "(", ")", ")", ";", "assertEquals", "(", "null", ",", "_vi", ".", "getSource", "(", ")", ")", ";", "assertEquals", "(", "null", ",", "_vi", ".", "getSink", "(", ")", ")", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_vi", ".", "getValue", "(", ")", ")", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_vi", ".", "getTolerance", "(", ")", ")", ";", "}", "public", "void", "testVectorInfoStringStringBlockBoolean", "(", ")", "{", "_vi", "=", "new", "VectorInfo", "(", "\"alpha\"", ",", "\"deg\"", ",", "null", ",", "true", ")", ";", "assertNotNull", "(", "_vi", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "_vi", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"deg\"", ",", "_vi", ".", "getUnits", "(", ")", ")", ";", "assertEquals", "(", "null", ",", "_vi", ".", "getSource", "(", ")", ")", ";", "assertEquals", "(", "null", ",", "_vi", ".", "getSink", "(", ")", ")", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_vi", ".", "getValue", "(", ")", ")", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_vi", ".", "getTolerance", "(", ")", ")", ";", "}", "public", "void", "testSetUnits", "(", ")", "{", "_vi", ".", "setUnits", "(", "\"newUnits\"", ")", ";", "assertEquals", "(", "\"newUnits\"", ",", "_vi", ".", "getUnits", "(", ")", ")", ";", "}", "public", "void", "testSetValueDouble", "(", ")", "{", "_vi", ".", "setValue", "(", "-", "4.323", ")", ";", "assertEquals", "(", "-", "4.323", ",", "_vi", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testSetValueString", "(", ")", "{", "_vi", ".", "setValue", "(", "\"-77.323\"", ")", ";", "assertEquals", "(", "-", "77.323", ",", "_vi", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testSetToleranceDouble", "(", ")", "{", "_vi", ".", "setTolerance", "(", "-", "4.323", ")", ";", "assertEquals", "(", "-", "4.323", ",", "_vi", ".", "getTolerance", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testSetToleranceString", "(", ")", "{", "_vi", ".", "setTolerance", "(", "\"-77.323\"", ")", ";", "assertEquals", "(", "-", "77.323", ",", "_vi", ".", "getTolerance", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testIsInput", "(", ")", "{", "assertNotNull", "(", "_inputs", ")", ";", "VectorInfo", "input0", "=", "_inputs", ".", "get", "(", "0", ")", ";", "assertTrue", "(", "input0", ".", "isInput", "(", ")", ")", ";", "}", "public", "void", "testGetSource", "(", ")", "{", "VectorInfo", "output0", "=", "_outputs", ".", "get", "(", "0", ")", ";", "assertFalse", "(", "output0", ".", "isInput", "(", ")", ")", ";", "BlockOutput", "outblk", "=", "output0", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "outblk", ")", ";", "assertEquals", "(", "\"output\"", ",", "outblk", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetSink", "(", ")", "{", "VectorInfo", "input0", "=", "_inputs", ".", "get", "(", "0", ")", ";", "BlockInput", "inblk", "=", "input0", ".", "getSink", "(", ")", ";", "assertNotNull", "(", "inblk", ")", ";", "assertEquals", "(", "\"input\"", ",", "inblk", ".", "getType", "(", ")", ")", ";", "}", "protected", "Model", "genSampleModel", "(", ")", "{", "Element", "theValue", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue", ".", "addContent", "(", "\"input\"", ")", ";", "Element", "minus", "=", "new", "Element", "(", "\"minus\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "minus", ")", ";", "applyElement", ".", "addContent", "(", "theValue", ")", ";", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "Signal", "in", "=", "new", "Signal", "(", "\"input\"", ",", "m", ")", ";", "Signal", "out", "=", "new", "Signal", "(", "\"output\"", ",", "m", ")", ";", "new", "BlockInput", "(", "in", ",", "m", ")", ";", "new", "BlockOutput", "(", "out", ",", "m", ")", ";", "Block", "gain", "=", "new", "BlockMathMinus", "(", "applyElement", ",", "m", ")", ";", "try", "{", "gain", ".", "addOutput", "(", "out", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "gain", ".", "hookUp", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "m", ";", "}", "}", "</s>" ]
8,428
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockOutputTest", "extends", "TestCase", "{", "private", "Model", "_model", ";", "private", "String", "_signalID", ";", "private", "Signal", "_signal", ";", "private", "BlockMathConstant", "_constBlock", ";", "private", "BlockOutput", "_block", ";", "protected", "StringWriter", "_writer", ";", "private", "final", "double", "EPS", "=", "0.00000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_model", "=", "new", "Model", "(", "4", ",", "4", ")", ";", "_signalID", "=", "\"outputValue\"", ";", "_signal", "=", "new", "Signal", "(", "_signalID", ",", "_model", ")", ";", "_constBlock", "=", "new", "BlockMathConstant", "(", "\"3.45\"", ",", "_model", ")", ";", "_constBlock", ".", "addOutput", "(", "_signal", ")", ";", "assertNotNull", "(", "_constBlock", ")", ";", "_model", ".", "hookUpIO", "(", ")", ";", "assertTrue", "(", "_signal", ".", "hasDest", "(", ")", ")", ";", "BlockArrayList", "destBlocks", "=", "_signal", ".", "getDests", "(", ")", ";", "assertNotNull", "(", "destBlocks", ")", ";", "assertEquals", "(", "1", ",", "destBlocks", ".", "size", "(", ")", ")", ";", "Block", "destBlock", "=", "destBlocks", ".", "get", "(", "0", ")", ";", "assertNotNull", "(", "destBlock", ")", ";", "assertEquals", "(", "\"output\"", ",", "destBlock", ".", "getType", "(", ")", ")", ";", "_block", "=", "(", "BlockOutput", ")", "destBlock", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_block", ".", "getValue", "(", ")", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "void", "testGetValue", "(", ")", "{", "assertEquals", "(", "3.45", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "3.45", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "_constBlock", ".", "setValue", "(", "\"-999.345\"", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "assertEquals", "(", "-", "999.345", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testGetUnits", "(", ")", "{", "assertEquals", "(", "\"unkn\"", ",", "_block", ".", "getUnits", "(", ")", ")", ";", "}", "public", "void", "testGetSeqNumber", "(", ")", "{", "assertEquals", "(", "1", ",", "_block", ".", "getSeqNumber", "(", ")", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "}", "</s>" ]
8,429
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "public", "class", "BlockMathFunctionExtensionTest", "extends", "BlockMathFunctionTest", "{", "final", "double", "piOver4", "=", "Math", ".", "PI", "/", "4.0", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "instantiateAtan2Function", "(", "0.5", ",", "0.5", ")", ";", "}", "public", "void", "testBlockMathFunction_ctor", "(", ")", "{", "instantiateAtan2Function", "(", "0.0", ",", "0.5", ")", ";", "assertEquals", "(", "0.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "0.5", ",", "0.5", ")", ";", "assertEquals", "(", "1.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "0.5", ",", "0.0", ")", ";", "assertEquals", "(", "2.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "0.5", ",", "-", "0.5", ")", ";", "assertEquals", "(", "3.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "0.0", ",", "-", "0.5", ")", ";", "assertEquals", "(", "4.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "-", "0.5", ",", "0.5", ")", ";", "assertEquals", "(", "-", "1.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "-", "0.5", ",", "0.0", ")", ";", "assertEquals", "(", "-", "2.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "-", "0.5", ",", "-", "0.5", ")", ";", "assertEquals", "(", "-", "3.", "*", "piOver4", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateAtan2Function", "(", "0.0", ",", "0.0", ")", ";", "assertEquals", "(", "0.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "updateExistingBlock", "(", "\"atan2\"", ",", "0.0", ",", "0.5", ",", "0.0", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "0.5", ",", "0.5", ",", "1.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "0.5", ",", "0.0", ",", "2.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "0.5", ",", "-", "0.5", ",", "3.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "0.0", ",", "-", "0.5", ",", "4.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "-", "0.5", ",", "0.5", ",", "-", "1.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "-", "0.5", ",", "0.0", ",", "-", "2.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "-", "0.5", ",", "-", "0.5", ",", "-", "3.", "*", "piOver4", ")", ";", "updateExistingBlock", "(", "\"atan2\"", ",", "0.0", ",", "0.0", ",", "0.0", ")", ";", "}", "public", "void", "updateExistingBlock", "(", "String", "func", ",", "double", "arg1", ",", "double", "arg2", ",", "double", "expectedValue", ")", "{", "BlockMathConstant", "constBlk", "=", "null", ";", "constBlk", "=", "getUpstreamConstBlk1", "(", ")", ";", "constBlk", ".", "setValue", "(", "arg1", ")", ";", "constBlk", "=", "getUpstreamConstBlk2", "(", ")", ";", "constBlk", ".", "setValue", "(", "arg2", ")", ";", "try", "{", "_block", ".", "setFunction", "(", "func", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_block", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "expectedValue", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "protected", "void", "instantiateAtan2Function", "(", "double", "argument1", ",", "double", "argument2", ")", "{", "String", "csymbol", "=", "\"csymbol\"", ";", "String", "attrName1", "=", "\"\"", ";", "String", "attrValue1", "=", "\"\"", ";", "String", "attrName2", "=", "\"encoding\"", ";", "String", "attrValue2", "=", "\"text\"", ";", "String", "extFuncName", "=", "\"atan2\"", ";", "ArrayList", "<", "Double", ">", "args", "=", "new", "ArrayList", "<", "Double", ">", "(", ")", ";", "boolean", "expectException", "=", "false", ";", "args", ".", "add", "(", "argument1", ")", ";", "args", ".", "add", "(", "argument2", ")", ";", "instantiateFunction", "(", "csymbol", ",", "\"\"", ",", "attrName1", ",", "attrValue1", ",", "attrName2", ",", "attrValue2", ",", "extFuncName", ",", "args", ",", "expectException", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "}", "</s>" ]
8,430
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathSwitch2Test", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "private", "StringWriter", "_writer", ";", "protected", "BlockMathSwitch", "_block", ";", "protected", "BlockMathConstant", "_inputBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_block", "=", "generateSampleSwitch", "(", "_model", ")", ";", "SignalArrayList", "theSignals", "=", "_model", ".", "getSignals", "(", ")", ";", "Signal", "inputSignal", "=", "theSignals", ".", "findByID", "(", "\"switchVal\"", ")", ";", "assertNotNull", "(", "inputSignal", ")", ";", "Block", "theBlock", "=", "inputSignal", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "theBlock", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "myType", ")", ";", "_inputBlock", "=", "(", "BlockMathConstant", ")", "theBlock", ";", "assertNotNull", "(", "_inputBlock", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "assertNotNull", "(", "_block", ")", ";", "String", "routineName", "=", "\"\"", ";", "_model", ".", "wireBlocks", "(", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "99.", ")", ")", ";", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "1.", ")", ")", ";", "assertEquals", "(", "-", "0.5", ",", "checkSwitch", "(", "-", "0.5", ")", ")", ";", "assertEquals", "(", "-", "0.000001", ",", "checkSwitch", "(", "-", "0.000001", ")", ")", ";", "assertEquals", "(", "-", "0.0", ",", "checkSwitch", "(", "-", "0.0", ")", ")", ";", "assertEquals", "(", "0.0", ",", "checkSwitch", "(", "0.0", ")", ")", ";", "assertEquals", "(", "0.0", ",", "checkSwitch", "(", "+", "0.0", ")", ")", ";", "assertEquals", "(", "+", "0.000001", ",", "checkSwitch", "(", "+", "0.000001", ")", ")", ";", "assertEquals", "(", "+", "0.5", ",", "checkSwitch", "(", "+", "0.5", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "1.", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "99.", ")", ")", ";", "}", "private", "double", "checkSwitch", "(", "Double", "switchVal", ")", "{", "String", "routineName", "=", "\"\"", ";", "_inputBlock", ".", "setValue", "(", "switchVal", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"", "for", "[\"", "+", "switchVal", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "_block", ".", "getValue", "(", ")", ";", "}", "private", "void", "checkCode", "(", "String", "code", ")", "{", "Signal", "defaultInput", "=", "_block", ".", "inputs", ".", "get", "(", "2", ")", ";", "defaultInput", ".", "setDefinedFlag", "(", ")", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "code", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"}n\"", ";", "checkCode", "(", "code", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"ENDIFn\"", ";", "checkCode", "(", "code", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "static", "BlockMathSwitch", "generateSampleSwitch", "(", "Model", "model", ")", "{", "Block", "swValueBlock", ";", "String", "swValueSignalID", ";", "Signal", "swValueSignal", ";", "Signal", "outputSignal", ";", "swValueBlock", "=", "new", "BlockMathConstant", "(", "\"99\"", ",", "model", ")", ";", "swValueSignalID", "=", "\"switchVal\"", ";", "swValueSignal", "=", "new", "Signal", "(", "\"switch", "value\"", ",", "swValueSignalID", ",", "\"nd\"", ",", "1", ",", "model", ")", ";", "try", "{", "swValueBlock", ".", "addOutput", "(", "swValueSignal", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "model", ")", ";", "Element", "innerApply1", "=", "new", "Element", "(", "\"apply\"", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"lt\"", ")", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"switchVal\"", ")", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"-1\"", ")", ")", ";", "Element", "innerApply2", "=", "new", "Element", "(", "\"apply\"", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"gt\"", ")", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"switchVal\"", ")", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"1\"", ")", ")", ";", "Element", "piece1", "=", "new", "Element", "(", "\"piece\"", ")", ";", "piece1", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"-1\"", ")", ")", ";", "piece1", ".", "addContent", "(", "innerApply1", ")", ";", "Element", "piece2", "=", "new", "Element", "(", "\"piece\"", ")", ";", "piece2", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"1\"", ")", ")", ";", "piece2", ".", "addContent", "(", "innerApply2", ")", ";", "Element", "otherwise", "=", "new", "Element", "(", "\"otherwise\"", ")", ";", "otherwise", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"switchVal\"", ")", ")", ";", "Element", "piecewise", "=", "new", "Element", "(", "\"piecewise\"", ")", ";", "piecewise", ".", "addContent", "(", "piece1", ")", ";", "piecewise", ".", "addContent", "(", "piece2", ")", ";", "piecewise", ".", "addContent", "(", "otherwise", ")", ";", "Element", "outerApply", "=", "new", "Element", "(", "\"apply\"", ")", ";", "outerApply", ".", "addContent", "(", "piecewise", ")", ";", "BlockMathSwitch", "bms", "=", "null", ";", "bms", "=", "new", "BlockMathSwitch", "(", "outerApply", ",", "model", ")", ";", "try", "{", "bms", ".", "addOutput", "(", "outputSignal", ")", ";", "model", ".", "wireBlocks", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "bms", ";", "}", "}", "</s>" ]
8,431
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "junit", ".", "framework", ".", "*", ";", "public", "class", "BlockMathConstantTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "BlockMathConstant", "_block", ";", "protected", "Signal", "_outSig", ";", "protected", "StringWriter", "_writer", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "{", "_model", "=", "new", "Model", "(", ")", ";", "_outSig", "=", "new", "Signal", "(", "\"\"", ",", "_model", ")", ";", "_block", "=", "new", "BlockMathConstant", "(", "\"-3.45\"", ",", "_model", ")", ";", "try", "{", "_block", ".", "addOutput", "(", "_outSig", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "BlockMathConstantTest", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "_writer", "=", "new", "StringWriter", "(", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "assertTrue", "(", "_block", ".", "getValue", "(", ")", "==", "-", "3.45", ")", ";", "}", "public", "void", "testSetValueString", "(", ")", "{", "_block", ".", "setValue", "(", "\"4.56\"", ")", ";", "assertEquals", "(", "4.56", ",", "_block", ".", "getValue", "(", ")", ")", ";", "}", "public", "void", "testSetValueDouble", "(", ")", "{", "_block", ".", "setValue", "(", "-", "5.67", ")", ";", "assertEquals", "(", "-", "5.67", ",", "_block", ".", "getValue", "(", ")", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "_block", ".", "setValue", "(", "4.56", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e1", ")", "{", "fail", "(", "\"\"", ")", ";", "}", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", ")", ";", "}", "assertEquals", "(", "4.56", ",", "_block", ".", "getValue", "(", ")", ",", "0.000001", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "1", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "silence", "(", ")", ";", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetModel", "(", ")", "{", "assertEquals", "(", "_model", ".", "getName", "(", ")", ",", "_block", ".", "getModel", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetSetName", "(", ")", "{", "assertEquals", "(", "\"const_0\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "_block", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"\"", ",", "_block", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "Iterator", "<", "String", ">", "it", "=", "_block", ".", "getVarIDIterator", "(", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutput", "(", ")", "{", "Signal", "s", "=", "_block", ".", "getOutput", "(", ")", ";", "assertEquals", "(", "_outSig", ",", "s", ")", ";", "}", "public", "void", "getGetInputIterator", "(", ")", "{", "Iterator", "<", "Signal", ">", "it", "=", "_block", ".", "getInputIterator", "(", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "_outSig", ".", "getVarID", "(", ")", ",", "_block", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "0", ",", "_block", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "0", ",", "_block", ".", "numVarIDs", "(", ")", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "BlockMathConstantTest", ".", "class", ")", ";", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,432
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathSumTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "Signal", "_outputSignal", ";", "protected", "Signal", "_value1Signal", ";", "protected", "Signal", "_value2Signal", ";", "protected", "String", "_value1SignalID", ";", "protected", "String", "_value2SignalID", ";", "protected", "BlockMathConstant", "_value1Block", ";", "protected", "BlockMathConstant", "_value2Block", ";", "protected", "BlockMathSum", "_block", ";", "private", "StringWriter", "_writer", ";", "private", "final", "double", "EPS", "=", "0.000001", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "String", "routineName", "=", "\"\"", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_value1Block", "=", "new", "BlockMathConstant", "(", "\"-3.5\"", ",", "_model", ")", ";", "_value2Block", "=", "new", "BlockMathConstant", "(", "\"", "2.0\"", ",", "_model", ")", ";", "_value1SignalID", "=", "\"PB\"", ";", "_value2SignalID", "=", "\"BSPAN\"", ";", "_value1Signal", "=", "new", "Signal", "(", "\"PB\"", ",", "_value1SignalID", ",", "\"d_s\"", ",", "1", ",", "_model", ")", ";", "_value2Signal", "=", "new", "Signal", "(", "\"BSPAN\"", ",", "_value2SignalID", ",", "\"ft\"", ",", "1", ",", "_model", ")", ";", "_value1Block", ".", "addOutput", "(", "_value1Signal", ")", ";", "_value2Block", ".", "addOutput", "(", "_value2Signal", ")", ";", "_outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "_model", ")", ";", "Element", "theValue1", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue1", ".", "addContent", "(", "\"PB\"", ")", ";", "Element", "theValue2", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue2", ".", "addContent", "(", "\"BSPAN\"", ")", ";", "Element", "thePlusElement", "=", "new", "Element", "(", "\"plus\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "thePlusElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue1", ")", ";", "applyElement", ".", "addContent", "(", "theValue2", ")", ";", "_block", "=", "new", "BlockMathSum", "(", "applyElement", ",", "_model", ")", ";", "_block", ".", "addInput", "(", "_value1Signal", ",", "1", ")", ";", "_block", ".", "addInput", "(", "_value2Signal", ",", "2", ")", ";", "_block", ".", "addOutput", "(", "_outputSignal", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", ")", ";", "}", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "this", ".", "checkVarNames", "(", "result", ")", ";", "}", "public", "void", "checkVarNames", "(", "CodeAndVarNames", "result", ")", "{", "assertEquals", "(", "3", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"outputSignal\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"PB\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "result", ".", "getVarName", "(", "2", ")", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "assertEquals", "(", "-", "1.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "public", "void", "testIsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "isReady", "(", ")", ")", ";", "}", "public", "void", "testAllInputsReady", "(", ")", "{", "assertTrue", "(", "_block", ".", "allInputsReady", "(", ")", ")", ";", "}", "public", "void", "testMakeVerbose", "(", ")", "{", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "_block", ".", "silence", "(", ")", ";", "assertFalse", "(", "_block", ".", "isVerbose", "(", ")", ")", ";", "}", "public", "void", "testGetName", "(", ")", "{", "assertEquals", "(", "\"plus_3\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testGetType", "(", ")", "{", "assertEquals", "(", "\"summing\"", ",", "_block", ".", "getType", "(", ")", ")", ";", "}", "public", "void", "testGetVarID", "(", ")", "{", "assertEquals", "(", "\"PB\"", ",", "_block", ".", "getVarID", "(", "1", ")", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "_block", ".", "getVarID", "(", "2", ")", ")", ";", "}", "public", "void", "testGetInputIterator", "(", ")", "{", "Signal", "s", ";", "Iterator", "<", "Signal", ">", "it", "=", "_block", ".", "getInputIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_value1Signal", ",", "s", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "s", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "_value2Signal", ",", "s", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutput", "(", ")", "{", "assertEquals", "(", "_outputSignal", ",", "_block", ".", "getOutput", "(", ")", ")", ";", "}", "public", "void", "testGetVarIDIterator", "(", ")", "{", "String", "name", ";", "Iterator", "<", "String", ">", "it", "=", "_block", ".", "getVarIDIterator", "(", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"PB\"", ",", "name", ")", ";", "assertTrue", "(", "it", ".", "hasNext", "(", ")", ")", ";", "name", "=", "it", ".", "next", "(", ")", ";", "assertEquals", "(", "\"BSPAN\"", ",", "name", ")", ";", "assertFalse", "(", "it", ".", "hasNext", "(", ")", ")", ";", "}", "public", "void", "testGetOutputVarID", "(", ")", "{", "assertEquals", "(", "\"outputSignal\"", ",", "_block", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testSetName", "(", ")", "{", "_block", ".", "setName", "(", "\"fart\"", ")", ";", "assertEquals", "(", "\"fart\"", ",", "_block", ".", "getName", "(", ")", ")", ";", "}", "public", "void", "testNumInputs", "(", ")", "{", "assertEquals", "(", "2", ",", "_block", ".", "numInputs", "(", ")", ")", ";", "}", "public", "void", "testNumVarIDs", "(", ")", "{", "assertEquals", "(", "2", ",", "_block", ".", "numVarIDs", "(", ")", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "String", "routineName", "=", "new", "String", "(", "\"\"", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "checkSum", "(", "0.", ",", "0.", ")", ";", "checkSum", "(", "0.", ",", "-", "1.", ")", ";", "checkSum", "(", "0.", ",", "-", "1.01", ")", ";", "checkSum", "(", "0.", ",", "1.01", ")", ";", "checkSum", "(", "-", "9.", ",", "-", "1.", ")", ";", "}", "private", "void", "checkSum", "(", "Double", "n1", ",", "Double", "n2", ")", "{", "String", "routineName", "=", "new", "String", "(", "\"\"", ")", ";", "_value1Block", ".", "setValue", "(", "n1", ")", ";", "_value2Block", ".", "setValue", "(", "n2", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"\"", "+", "n1", ".", "toString", "(", ")", "+", "\"", "+", "\"", "+", "n2", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "n1", "+", "n2", ",", "_block", ".", "getValue", "(", ")", ")", ";", "}", "}", "</s>" ]
8,433
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathSwitch3Test", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "private", "StringWriter", "_writer", ";", "protected", "BlockMathSwitch", "_block", ";", "protected", "BlockMathConstant", "_inputBlock", ";", "protected", "BlockMathConstant", "_upperLimitBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "_block", "=", "generateSampleSwitch", "(", "_model", ")", ";", "SignalArrayList", "theSignals", "=", "_model", ".", "getSignals", "(", ")", ";", "Signal", "inputSignal", "=", "theSignals", ".", "findByID", "(", "\"ALP_UNLIM\"", ")", ";", "assertNotNull", "(", "inputSignal", ")", ";", "Block", "theBlock", "=", "inputSignal", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "theBlock", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "myType", ")", ";", "_inputBlock", "=", "(", "BlockMathConstant", ")", "theBlock", ";", "assertNotNull", "(", "_inputBlock", ")", ";", "inputSignal", "=", "theSignals", ".", "findByID", "(", "\"ALP_MAX_LIM\"", ")", ";", "assertNotNull", "(", "inputSignal", ")", ";", "theBlock", "=", "inputSignal", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "theBlock", ")", ";", "assertEquals", "(", "\"\"", ",", "theBlock", ".", "myType", ")", ";", "_upperLimitBlock", "=", "(", "BlockMathConstant", ")", "theBlock", ";", "assertNotNull", "(", "_upperLimitBlock", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "assertNotNull", "(", "_block", ")", ";", "String", "routineName", "=", "\"\"", ";", "_model", ".", "wireBlocks", "(", ")", ";", "try", "{", "_model", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\":", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "_upperLimitBlock", ".", "setValue", "(", "40.0", ")", ";", "assertEquals", "(", "-", "2.0", ",", "checkSwitch", "(", "-", "99.", ")", ")", ";", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "1.", ")", ")", ";", "assertEquals", "(", "0.0", ",", "checkSwitch", "(", "0.", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "1.", ")", ")", ";", "assertEquals", "(", "+", "5.0", ",", "checkSwitch", "(", "+", "5.", ")", ")", ";", "assertEquals", "(", "+", "10.0", ",", "checkSwitch", "(", "+", "10.", ")", ")", ";", "assertEquals", "(", "+", "20.0", ",", "checkSwitch", "(", "+", "20.", ")", ")", ";", "assertEquals", "(", "+", "30.0", ",", "checkSwitch", "(", "+", "30.", ")", ")", ";", "assertEquals", "(", "+", "40.0", ",", "checkSwitch", "(", "+", "40.", ")", ")", ";", "assertEquals", "(", "+", "40.0", ",", "checkSwitch", "(", "+", "99.", ")", ")", ";", "_upperLimitBlock", ".", "setValue", "(", "20.0", ")", ";", "assertEquals", "(", "-", "2.0", ",", "checkSwitch", "(", "-", "99.", ")", ")", ";", "assertEquals", "(", "-", "1.0", ",", "checkSwitch", "(", "-", "1.", ")", ")", ";", "assertEquals", "(", "0.0", ",", "checkSwitch", "(", "0.", ")", ")", ";", "assertEquals", "(", "+", "1.0", ",", "checkSwitch", "(", "+", "1.", ")", ")", ";", "assertEquals", "(", "+", "5.0", ",", "checkSwitch", "(", "+", "5.", ")", ")", ";", "assertEquals", "(", "+", "10.0", ",", "checkSwitch", "(", "+", "10.", ")", ")", ";", "assertEquals", "(", "+", "20.0", ",", "checkSwitch", "(", "+", "20.", ")", ")", ";", "assertEquals", "(", "+", "20.0", ",", "checkSwitch", "(", "+", "30.", ")", ")", ";", "assertEquals", "(", "+", "20.0", ",", "checkSwitch", "(", "+", "40.", ")", ")", ";", "assertEquals", "(", "+", "20.0", ",", "checkSwitch", "(", "+", "99.", ")", ")", ";", "}", "private", "double", "checkSwitch", "(", "Double", "switchVal", ")", "{", "String", "routineName", "=", "\"\"", ";", "_inputBlock", ".", "setValue", "(", "switchVal", ")", ";", "try", "{", "_model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "fail", "(", "\"\"", "+", "routineName", "+", "\"", "for", "[\"", "+", "switchVal", ".", "toString", "(", ")", "+", "\"]:", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "_block", ".", "getValue", "(", ")", ";", "}", "private", "void", "checkCode", "(", "String", "code", ")", "{", "Signal", "defaultInput", "=", "_block", ".", "inputs", ".", "get", "(", "2", ")", ";", "defaultInput", ".", "setDefinedFlag", "(", ")", ";", "CodeAndVarNames", "cvn", "=", "_block", ".", "genCode", "(", ")", ";", "assertEquals", "(", "code", ",", "cvn", ".", "getCode", "(", ")", ")", ";", "}", "public", "void", "testGenCcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"}n\"", ";", "checkCode", "(", "code", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "_model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "String", "code", "=", "\"\"", ";", "String", "indent", "=", "\"", "\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"\"", ";", "code", "=", "code", "+", "indent", "+", "\"ENDIFn\"", ";", "checkCode", "(", "code", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "public", "static", "BlockMathSwitch", "generateSampleSwitch", "(", "Model", "model", ")", "{", "Block", "alpMaxLim", "=", "new", "BlockMathConstant", "(", "\"40\"", ",", "model", ")", ";", "Signal", "alpMaxLimSignal", "=", "new", "Signal", "(", "\"\"", ",", "\"ALP_MAX_LIM\"", ",", "\"deg\"", ",", "1", ",", "model", ")", ";", "Block", "alpUnlim", "=", "new", "BlockMathConstant", "(", "\"0\"", ",", "model", ")", ";", "Signal", "alpUnlimSignal", "=", "new", "Signal", "(", "\"\"", ",", "\"ALP_UNLIM\"", ",", "\"deg\"", ",", "1", ",", "model", ")", ";", "Signal", "outputSignal", "=", "new", "Signal", "(", "\"outputSignal\"", ",", "model", ")", ";", "try", "{", "alpMaxLim", ".", "addOutput", "(", "alpMaxLimSignal", ")", ";", "alpUnlim", ".", "addOutput", "(", "alpUnlimSignal", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "Element", "innerApply1", "=", "new", "Element", "(", "\"apply\"", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"lt\"", ")", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"ALP_UNLIM\"", ")", ")", ";", "innerApply1", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"-2\"", ")", ")", ";", "Element", "innerApply2", "=", "new", "Element", "(", "\"apply\"", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"gt\"", ")", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"ALP_UNLIM\"", ")", ")", ";", "innerApply2", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"ALP_MAX_LIM\"", ")", ")", ";", "Element", "piece1", "=", "new", "Element", "(", "\"piece\"", ")", ";", "piece1", ".", "addContent", "(", "new", "Element", "(", "\"cn\"", ")", ".", "addContent", "(", "\"-2\"", ")", ")", ";", "piece1", ".", "addContent", "(", "innerApply1", ")", ";", "Element", "piece2", "=", "new", "Element", "(", "\"piece\"", ")", ";", "piece2", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"ALP_MAX_LIM\"", ")", ")", ";", "piece2", ".", "addContent", "(", "innerApply2", ")", ";", "Element", "otherwise", "=", "new", "Element", "(", "\"otherwise\"", ")", ";", "otherwise", ".", "addContent", "(", "new", "Element", "(", "\"ci\"", ")", ".", "addContent", "(", "\"ALP_UNLIM\"", ")", ")", ";", "Element", "piecewise", "=", "new", "Element", "(", "\"piecewise\"", ")", ";", "piecewise", ".", "addContent", "(", "piece1", ")", ";", "piecewise", ".", "addContent", "(", "piece2", ")", ";", "piecewise", ".", "addContent", "(", "otherwise", ")", ";", "Element", "outerApply", "=", "new", "Element", "(", "\"apply\"", ")", ";", "outerApply", ".", "addContent", "(", "piecewise", ")", ";", "BlockMathSwitch", "bms", "=", "null", ";", "bms", "=", "new", "BlockMathSwitch", "(", "outerApply", ",", "model", ")", ";", "try", "{", "bms", ".", "addOutput", "(", "outputSignal", ")", ";", "model", ".", "wireBlocks", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "bms", ";", "}", "}", "</s>" ]
8,434
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "NameListTest", "extends", "TestCase", "{", "protected", "NameList", "nl", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "nl", "=", "new", "NameList", "(", "4", ")", ";", "nl", ".", "add", "(", "\"name1\"", ")", ";", "nl", ".", "add", "(", "\"name2\"", ")", ";", "nl", ".", "add", "(", "\"name3\"", ")", ";", "}", "public", "void", "testFixName", "(", ")", "{", "assertEquals", "(", "\"name2_1\"", ",", "nl", ".", "fixName", "(", "\"name2_1\"", ")", ")", ";", "}", "public", "void", "testIsUnique", "(", ")", "{", "assertTrue", "(", "nl", ".", "isUnique", "(", "\"name4\"", ")", ")", ";", "assertFalse", "(", "nl", ".", "isUnique", "(", "\"name3\"", ")", ")", ";", "}", "public", "void", "testAddUnique", "(", ")", "{", "nl", ".", "addUnique", "(", "\"name2\"", ")", ";", "assertEquals", "(", "4", ",", "nl", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"name21\"", ",", "nl", ".", "get", "(", "3", ")", ")", ";", "nl", ".", "addUnique", "(", "\"name21\"", ")", ";", "assertEquals", "(", "5", ",", "nl", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"name211\"", ",", "nl", ".", "get", "(", "4", ")", ")", ";", "nl", ".", "addUnique", "(", "\"name22\"", ")", ";", "assertEquals", "(", "6", ",", "nl", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"name22\"", ",", "nl", ".", "get", "(", "5", ")", ")", ";", "}", "}", "</s>" ]
8,435
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "FileNotFoundException", ";", "import", "java", ".", "io", ".", "FileReader", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "TreeFileWriterTest", "extends", "TestCase", "{", "Model", "_m", ";", "TreeFileWriter", "_w", ";", "String", "_fileName", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_m", "=", "genSampleModel", "(", ")", ";", "_fileName", "=", "\"tempFile.txt\"", ";", "_w", "=", "new", "TreeFileWriter", "(", "_fileName", ")", ";", "}", "public", "void", "testTreeFileWriter", "(", ")", "{", "assertNotNull", "(", "_w", ")", ";", "}", "public", "void", "testDescribe", "(", ")", "{", "try", "{", "_w", ".", "describe", "(", "_m", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_w", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "FileReader", "f", "=", "null", ";", "try", "{", "f", "=", "new", "FileReader", "(", "_fileName", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertNotNull", "(", "f", ")", ";", "char", "[", "]", "buf", "=", "new", "char", "[", "1000", "]", ";", "try", "{", "f", ".", "read", "(", "buf", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "String", "contents", "=", "new", "String", "(", "buf", ")", ";", "int", "end", "=", "contents", ".", "lastIndexOf", "(", "'\\n'", ")", ";", "String", "expectedMessage", "=", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"n\"", "+", "\"n\"", "+", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"n\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ";", "assertEquals", "(", "expectedMessage", ",", "contents", ".", "substring", "(", "0", ",", "end", ")", ")", ";", "}", "protected", "Model", "genSampleModel", "(", ")", "{", "Model", "m", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "Block", "constBlk", "=", "new", "BlockMathConstant", "(", "\"3.4\"", ",", "m", ")", ";", "Signal", "sig", "=", "new", "Signal", "(", "\"theSig\"", ",", "m", ")", ";", "try", "{", "constBlk", ".", "addOutput", "(", "sig", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "new", "BlockOutput", "(", "sig", ",", "m", ")", ";", "return", "m", ";", "}", "}", "</s>" ]
8,436
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BreakpointSetTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "BreakpointSet", "_bps", ";", "protected", "BlockBP", "_bpb", ";", "private", "final", "Double", "EPS", "=", "0.000001", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "}", "public", "void", "testBreakpointSetModel", "(", ")", "{", "_bps", "=", "new", "BreakpointSet", "(", "_model", ")", ";", "assertEquals", "(", "\"\"", ",", "_bps", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"\"", ",", "_bps", ".", "getBPID", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "_bps", ".", "length", "(", ")", ")", ";", "assertFalse", "(", "_bps", ".", "isVerbose", "(", ")", ")", ";", "assertNull", "(", "_bps", ".", "values", "(", ")", ")", ";", "}", "public", "void", "testBreakpointSetElementModel", "(", ")", "{", "Element", "bpValElement", "=", "new", "Element", "(", "\"bpVals\"", ")", ";", "bpValElement", ".", "addContent", "(", "\"\"", ")", ";", "Element", "descriptionElement", "=", "new", "Element", "(", "\"description\"", ")", ";", "descriptionElement", ".", "addContent", "(", "\"\"", ")", ";", "Element", "bpDefElement", "=", "new", "Element", "(", "\"\"", ")", ";", "bpDefElement", ".", "setAttribute", "(", "\"name\"", ",", "\"alpha\"", ")", ";", "bpDefElement", ".", "setAttribute", "(", "\"bpID\"", ",", "\"ALPHA1\"", ")", ";", "bpDefElement", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "bpDefElement", ".", "addContent", "(", "descriptionElement", ")", ";", "bpDefElement", ".", "addContent", "(", "bpValElement", ")", ";", "try", "{", "_bps", "=", "new", "BreakpointSet", "(", "bpDefElement", ",", "_model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "checkBPS", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "_bps", ".", "myDescription", ")", ";", "}", "public", "void", "testBreakpointSetStringStringStringStringModel", "(", ")", "{", "try", "{", "_bps", "=", "new", "BreakpointSet", "(", "\"alpha\"", ",", "\"ALPHA1\"", ",", "\"\"", ",", "\"\"", ",", "_model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "checkBPS", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "_bps", ".", "myDescription", ")", ";", "}", "public", "void", "testRegister", "(", ")", "{", "_bps", "=", "new", "BreakpointSet", "(", "_model", ")", ";", "_bps", ".", "register", "(", "_bpb", ")", ";", "assertNotNull", "(", "_bps", ".", "users", ")", ";", "BlockBP", "bpb", "=", "(", "BlockBP", ")", "_bps", ".", "users", ".", "get", "(", "0", ")", ";", "assertEquals", "(", "_bpb", ",", "bpb", ")", ";", "}", "public", "void", "testIsVerbose", "(", ")", "{", "_bps", "=", "new", "BreakpointSet", "(", "_model", ")", ";", "assertFalse", "(", "_bps", ".", "isVerbose", "(", ")", ")", ";", "_bps", ".", "makeVerbose", "(", ")", ";", "assertTrue", "(", "_bps", ".", "isVerbose", "(", ")", ")", ";", "_bps", ".", "silence", "(", ")", ";", "assertFalse", "(", "_bps", ".", "isVerbose", "(", ")", ")", ";", "}", "private", "void", "checkBPS", "(", ")", "{", "assertNotNull", "(", "_bps", ")", ";", "assertEquals", "(", "\"alpha\"", ",", "_bps", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"ALPHA1\"", ",", "_bps", ".", "getBPID", "(", ")", ")", ";", "assertEquals", "(", "12", ",", "_bps", ".", "length", "(", ")", ")", ";", "assertFalse", "(", "_bps", ".", "isVerbose", "(", ")", ")", ";", "assertNotNull", "(", "_bps", ".", "values", "(", ")", ")", ";", "ArrayList", "<", "Double", ">", "vals", "=", "_bps", ".", "values", "(", ")", ";", "assertNotNull", "(", "vals", ")", ";", "assertEquals", "(", "12", ",", "vals", ".", "size", "(", ")", ")", ";", "checkValues", "(", "vals", ")", ";", "}", "private", "void", "checkValues", "(", "ArrayList", "<", "Double", ">", "vals", ")", "{", "assertEquals", "(", "-", "10.", ",", "vals", ".", "get", "(", "0", ")", ",", "EPS", ")", ";", "assertEquals", "(", "-", "5.", ",", "vals", ".", "get", "(", "1", ")", ",", "EPS", ")", ";", "assertEquals", "(", "0.", ",", "vals", ".", "get", "(", "2", ")", ",", "EPS", ")", ";", "assertEquals", "(", "5.", ",", "vals", ".", "get", "(", "3", ")", ",", "EPS", ")", ";", "assertEquals", "(", "10.", ",", "vals", ".", "get", "(", "4", ")", ",", "EPS", ")", ";", "assertEquals", "(", "15.", ",", "vals", ".", "get", "(", "5", ")", ",", "EPS", ")", ";", "assertEquals", "(", "20.", ",", "vals", ".", "get", "(", "6", ")", ",", "EPS", ")", ";", "assertEquals", "(", "25.", ",", "vals", ".", "get", "(", "7", ")", ",", "EPS", ")", ";", "assertEquals", "(", "30.", ",", "vals", ".", "get", "(", "8", ")", ",", "EPS", ")", ";", "assertEquals", "(", "35.", ",", "vals", ".", "get", "(", "9", ")", ",", "EPS", ")", ";", "assertEquals", "(", "40.", ",", "vals", ".", "get", "(", "10", ")", ",", "EPS", ")", ";", "assertEquals", "(", "45.", ",", "vals", ".", "get", "(", "11", ")", ",", "EPS", ")", ";", "}", "public", "static", "BreakpointSet", "generateSampleAlphaBreakpointSet", "(", "Model", "model", ")", "{", "BreakpointSet", "bpAlpha", "=", "null", ";", "try", "{", "bpAlpha", "=", "new", "BreakpointSet", "(", "\"alpha\"", ",", "\"ALPHA1\"", ",", "\"\"", ",", "\"\"", ",", "model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "bpAlpha", ";", "}", "public", "static", "BreakpointSet", "generateSampleElevBreakpointSet", "(", "Model", "model", ")", "{", "BreakpointSet", "bpDE", "=", "null", ";", "try", "{", "bpDE", "=", "new", "BreakpointSet", "(", "\"el\"", ",", "\"DE1\"", ",", "\"\"", ",", "\"\"", ",", "model", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "return", "bpDE", ";", "}", "}", "</s>" ]
8,437
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockLimiterTest", "extends", "TestCase", "{", "private", "Model", "model", ";", "private", "BlockInput", "inputBlk", ";", "private", "BlockLimiter", "symLimBlk", ";", "private", "BlockLimiter", "hiLimBlk", ";", "private", "BlockLimiter", "loLimBlk", ";", "private", "BlockLimiter", "noLimBlk", ";", "private", "BlockLimiter", "swapLimBlk", ";", "private", "Signal", "symOut", ",", "hiOut", ",", "loOut", ",", "noOut", ",", "swapOut", ";", "private", "Signal", "inputSignal", ";", "private", "StringWriter", "_writer", ";", "private", "BlockLimiter", "blockArray", "[", "]", ";", "private", "VectorInfoArrayList", "inputVector", ";", "private", "VectorInfoArrayList", "outputVector", ";", "private", "VectorInfo", "input", ";", "final", "private", "double", "eps", "=", "1e-6", ";", "private", "double", "inputValue", "[", "]", "=", "{", "-", "1000.0", ",", "0.0", ",", "1000.0", "}", ";", "private", "double", "expectedValue", "[", "]", "[", "]", "=", "{", "{", "-", "2.0", ",", "-", "1000.0", ",", "-", "2.0", ",", "-", "1000.0", ",", "-", "2.0", "}", ",", "{", "0.0", ",", "0.0", ",", "0.0", ",", "0.0", ",", "0.0", "}", ",", "{", "+", "2.0", ",", "+", "2.0", ",", "+", "1000.0", ",", "+", "1000.0", ",", "+", "2.0", "}", "}", ";", "public", "BlockLimiterTest", "(", "String", "testName", ")", "{", "super", "(", "testName", ")", ";", "}", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "assert", "(", "_writer", "!=", "null", ")", ";", "model", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "assert", "(", "model", "!=", "null", ")", ";", "inputSignal", "=", "new", "Signal", "(", "\"\"", ",", "\"input\"", ",", "\"furlongs\"", ",", "3", ",", "model", ")", ";", "assert", "(", "inputSignal", "!=", "null", ")", ";", "inputBlk", "=", "new", "BlockInput", "(", "inputSignal", ",", "model", ")", ";", "assert", "(", "inputBlk", "!=", "null", ")", ";", "symOut", "=", "new", "Signal", "(", "\"\"", ",", "\"symLim\"", ",", "\"furlongs\"", ",", "1", ",", "model", ")", ";", "assert", "(", "symOut", "!=", "null", ")", ";", "hiOut", "=", "new", "Signal", "(", "\"\"", ",", "\"hiLim\"", ",", "\"furlongs\"", ",", "1", ",", "model", ")", ";", "assert", "(", "hiOut", "!=", "null", ")", ";", "loOut", "=", "new", "Signal", "(", "\"\"", ",", "\"loLim\"", ",", "\"furlongs\"", ",", "1", ",", "model", ")", ";", "assert", "(", "loOut", "!=", "null", ")", ";", "noOut", "=", "new", "Signal", "(", "\"\"", ",", "\"noLim\"", ",", "\"furlongs\"", ",", "1", ",", "model", ")", ";", "assert", "(", "noOut", "!=", "null", ")", ";", "swapOut", "=", "new", "Signal", "(", "\"\"", ",", "\"swapLim\"", ",", "\"furlongs\"", ",", "1", ",", "model", ")", ";", "assert", "(", "swapOut", "!=", "null", ")", ";", "symLimBlk", "=", "new", "BlockLimiter", "(", "inputSignal", ",", "model", ",", "-", "2.0", ",", "2.0", ")", ";", "assert", "(", "symLimBlk", "!=", "null", ")", ";", "symLimBlk", ".", "addOutput", "(", "symOut", ")", ";", "hiLimBlk", "=", "new", "BlockLimiter", "(", "inputSignal", ",", "model", ",", "Double", ".", "NEGATIVE_INFINITY", ",", "2.0", ")", ";", "assert", "(", "hiLimBlk", "!=", "null", ")", ";", "hiLimBlk", ".", "addOutput", "(", "hiOut", ")", ";", "loLimBlk", "=", "new", "BlockLimiter", "(", "inputSignal", ",", "model", ",", "-", "2.0", ",", "Double", ".", "POSITIVE_INFINITY", ")", ";", "assert", "(", "loLimBlk", "!=", "null", ")", ";", "loLimBlk", ".", "addOutput", "(", "loOut", ")", ";", "noLimBlk", "=", "new", "BlockLimiter", "(", "inputSignal", ",", "model", ",", "Double", ".", "NEGATIVE_INFINITY", ",", "Double", ".", "POSITIVE_INFINITY", ")", ";", "assert", "(", "noLimBlk", "!=", "null", ")", ";", "noLimBlk", ".", "addOutput", "(", "noOut", ")", ";", "swapLimBlk", "=", "new", "BlockLimiter", "(", "inputSignal", ",", "model", ",", "+", "2.0", ",", "-", "2.0", ")", ";", "assert", "(", "swapLimBlk", "!=", "null", ")", ";", "swapLimBlk", ".", "addOutput", "(", "swapOut", ")", ";", "blockArray", "=", "new", "BlockLimiter", "[", "5", "]", ";", "blockArray", "[", "0", "]", "=", "symLimBlk", ";", "blockArray", "[", "1", "]", "=", "hiLimBlk", ";", "blockArray", "[", "2", "]", "=", "loLimBlk", ";", "blockArray", "[", "3", "]", "=", "noLimBlk", ";", "blockArray", "[", "4", "]", "=", "swapLimBlk", ";", "inputVector", "=", "model", ".", "getInputVector", "(", ")", ";", "assert", "(", "inputVector", "!=", "null", ")", ";", "assertEquals", "(", "1", ",", "inputVector", ".", "size", "(", ")", ")", ";", "input", "=", "inputVector", ".", "get", "(", "0", ")", ";", "assert", "(", "input", "!=", "null", ")", ";", "model", ".", "hookUpIO", "(", ")", ";", "model", ".", "initialize", "(", ")", ";", "outputVector", "=", "model", ".", "getOutputVector", "(", ")", ";", "assert", "(", "outputVector", "!=", "null", ")", ";", "assertEquals", "(", "5", ",", "outputVector", ".", "size", "(", ")", ")", ";", "}", "@", "Override", "protected", "void", "tearDown", "(", ")", "throws", "Exception", "{", "super", ".", "tearDown", "(", ")", ";", "}", "public", "void", "testGetValue", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "input", ".", "setValue", "(", "inputValue", "[", "i", "]", ")", ";", "try", "{", "model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "String", "msg", "=", "e", ".", "getMessage", "(", ")", ";", "}", "for", "(", "int", "j", "=", "0", ";", "j", "<", "outputVector", ".", "size", "(", ")", ";", "j", "++", ")", "{", "double", "value", "=", "outputVector", ".", "get", "(", "j", ")", ".", "getValue", "(", ")", ";", "assertEquals", "(", "expectedValue", "[", "i", "]", "[", "j", "]", ",", "value", ",", "eps", ")", ";", "}", "}", "}", "public", "void", "testGetUnits", "(", ")", "{", "BlockLimiter", "blk", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "blockArray", ".", "length", ";", "j", "++", ")", "{", "blk", "=", "blockArray", "[", "j", "]", ";", "assertEquals", "(", "\"furlongs\"", ",", "blk", ".", "getUnits", "(", ")", ")", ";", "}", "}", "public", "void", "testGenCcode", "(", ")", "{", "BlockLimiter", "blk", ";", "model", ".", "setCodeDialect", "(", "Model", ".", "DT_ANSI_C", ")", ";", "CodeAndVarNames", "result", "=", "new", "CodeAndVarNames", "(", ")", ";", "blk", "=", "blockArray", "[", "0", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"symLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "1", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"hiLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "2", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"loLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "3", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"noLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "4", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", "+", "\"\"", "+", "\"\"", "+", "\"", "}n\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"swapLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "}", "public", "void", "testGenFcode", "(", ")", "{", "BlockLimiter", "blk", ";", "model", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "CodeAndVarNames", "result", "=", "new", "CodeAndVarNames", "(", ")", ";", "blk", "=", "blockArray", "[", "0", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"symLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "1", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"hiLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "2", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "blk", "=", "blockArray", "[", "3", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"noLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "blk", "=", "blockArray", "[", "4", "]", ";", "result", "=", "blk", ".", "genCode", "(", ")", ";", "assertEquals", "(", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", "+", "\"\"", ",", "result", ".", "getCode", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "result", ".", "getVarNames", "(", ")", ".", "size", "(", ")", ")", ";", "assertEquals", "(", "\"swapLim\"", ",", "result", ".", "getVarName", "(", "0", ")", ")", ";", "assertEquals", "(", "\"input\"", ",", "result", ".", "getVarName", "(", "1", ")", ")", ";", "}", "public", "void", "testDescribeSelf", "(", ")", "throws", "Exception", "{", "BlockLimiter", "blk", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "blockArray", ".", "length", ";", "i", "++", ")", "{", "blk", "=", "blockArray", "[", "i", "]", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "String", "testString", "=", "_writer", ".", "toString", "(", ")", ";", "try", "{", "blk", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "assertTrue", "(", "false", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "blk", ".", "getOutput", "(", ")", ".", "getName", "(", ")", "+", "\"),\"", "+", "\"\"", "+", "Double", ".", "toString", "(", "blk", ".", "getLowerLimit", "(", ")", ")", "+", "\"\"", "+", "Double", ".", "toString", "(", "blk", ".", "getUpperLimit", "(", ")", ")", "+", "\".\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "}", "public", "void", "testHasLowerLimit", "(", ")", "{", "assert", "(", "symLimBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "assert", "(", "!", "hiLimBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "assert", "(", "loLimBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "assert", "(", "!", "noLimBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "assert", "(", "swapLimBlk", ".", "hasLowerLimit", "(", ")", ")", ";", "}", "public", "void", "testHasUpperLimit", "(", ")", "{", "assert", "(", "symLimBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "assert", "(", "hiLimBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "assert", "(", "!", "loLimBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "assert", "(", "!", "noLimBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "assert", "(", "swapLimBlk", ".", "hasUpperLimit", "(", ")", ")", ";", "}", "public", "void", "testGetLowerLimit", "(", ")", "{", "assertEquals", "(", "-", "2.0", ",", "symLimBlk", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "assert", "(", "Double", ".", "isInfinite", "(", "hiLimBlk", ".", "getLowerLimit", "(", ")", ")", ")", ";", "assertEquals", "(", "-", "2.0", ",", "loLimBlk", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "assert", "(", "Double", ".", "isInfinite", "(", "noLimBlk", ".", "getLowerLimit", "(", ")", ")", ")", ";", "assertEquals", "(", "-", "2.0", ",", "swapLimBlk", ".", "getLowerLimit", "(", ")", ",", "eps", ")", ";", "}", "public", "void", "testGetUpperLimit", "(", ")", "{", "assertEquals", "(", "+", "2.0", ",", "symLimBlk", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "assertEquals", "(", "+", "2.0", ",", "hiLimBlk", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "assert", "(", "Double", ".", "isInfinite", "(", "loLimBlk", ".", "getUpperLimit", "(", ")", ")", ")", ";", "assert", "(", "Double", ".", "isInfinite", "(", "noLimBlk", ".", "getUpperLimit", "(", ")", ")", ")", ";", "assertEquals", "(", "+", "2.0", ",", "swapLimBlk", ".", "getUpperLimit", "(", ")", ",", "eps", ")", ";", "}", "}", "</s>" ]
8,438
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "Arrays", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "SignalArrayListTest", "extends", "TestCase", "{", "protected", "SignalArrayList", "_list", ";", "protected", "Signal", "_sig1", ";", "protected", "Signal", "_sig2", ";", "protected", "Signal", "_sig3", ";", "protected", "Signal", "_sig4", ";", "protected", "Signal", "_sig5", ";", "protected", "Model", "_model", ";", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "2", ",", "2", ")", ";", "_list", "=", "new", "SignalArrayList", "(", "5", ")", ";", "_sig1", "=", "new", "Signal", "(", "\"signal_1\"", ",", "_model", ")", ";", "_sig2", "=", "new", "Signal", "(", "\"signal_2\"", ",", "_model", ")", ";", "_sig3", "=", "new", "Signal", "(", "\"signal_3\"", ",", "_model", ")", ";", "_sig4", "=", "new", "Signal", "(", "\"signal_4\"", ",", "_model", ")", ";", "_sig5", "=", "new", "Signal", "(", "\"signal_5\"", ",", "_model", ")", ";", "_list", ".", "add", "(", "_sig1", ")", ";", "_list", ".", "add", "(", "_sig2", ")", ";", "_list", ".", "add", "(", "_sig3", ")", ";", "_list", ".", "add", "(", "_sig4", ")", ";", "_list", ".", "add", "(", "_sig5", ")", ";", "}", "public", "void", "testSignalArrayList", "(", ")", "{", "SignalArrayList", "list", "=", "new", "SignalArrayList", "(", ")", ";", "assertNotNull", "(", "list", ")", ";", "}", "public", "void", "testSignalArrayListInt", "(", ")", "{", "assertNotNull", "(", "_list", ")", ";", "}", "public", "void", "testSignalArrayListCollectionOfSignal", "(", ")", "{", "Collection", "<", "Signal", ">", "c", "=", "Arrays", ".", "asList", "(", "_sig1", ",", "_sig2", ",", "_sig3", ",", "_sig4", ",", "_sig5", ")", ";", "SignalArrayList", "list", "=", "new", "SignalArrayList", "(", "c", ")", ";", "assertNotNull", "(", "list", ")", ";", "checkSignalArrayList", "(", "list", ")", ";", "}", "public", "void", "testFindByID", "(", ")", "{", "checkSignalArrayList", "(", "_list", ")", ";", "}", "protected", "void", "checkSignalArrayList", "(", "SignalArrayList", "list", ")", "{", "Signal", "sig", "=", "null", ";", "Integer", "i", "=", "5", ";", "while", "(", "i", ">", "0", ")", "{", "String", "id", "=", "\"signal_\"", "+", "i", ".", "toString", "(", ")", ";", "sig", "=", "list", ".", "findByID", "(", "id", ")", ";", "assertNotNull", "(", "sig", ")", ";", "assertEquals", "(", "id", ",", "sig", ".", "getVarID", "(", ")", ")", ";", "i", "--", ";", "}", "sig", "=", "list", ".", "findByID", "(", "\"nuts\"", ")", ";", "assertNull", "(", "sig", ")", ";", "}", "}", "</s>" ]
8,439
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "TestCase", ";", "public", "class", "BlockMathFunctionTest", "extends", "TestCase", "{", "protected", "Model", "_model", ";", "protected", "StringWriter", "_writer", ";", "protected", "BlockMathFunction", "_block", ";", "protected", "final", "double", "EPS", "=", "0.00000001", ";", "protected", "final", "double", "COS_0p5", "=", "0.87758256", ";", "protected", "final", "double", "SIN_0p5", "=", "0.47942553", ";", "protected", "final", "double", "TAN_0p5", "=", "0.54630249", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "throws", "Exception", "{", "super", ".", "setUp", "(", ")", ";", "_model", "=", "new", "Model", "(", "1", ",", "1", ")", ";", "_writer", "=", "new", "StringWriter", "(", ")", ";", "instantiateFunction", "(", "\"cos\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "}", "public", "void", "testBlockMathFunction_ctor", "(", ")", "{", "instantiateFunction", "(", "\"cos\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "assertEquals", "(", "COS_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"sin\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "assertEquals", "(", "SIN_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"tan\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "assertEquals", "(", "TAN_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"cos\"", ",", "\"\"", ",", "-", "0.5", ",", "false", ")", ";", "assertEquals", "(", "COS_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"sin\"", ",", "\"\"", ",", "-", "0.5", ",", "false", ")", ";", "assertEquals", "(", "-", "SIN_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"tan\"", ",", "\"\"", ",", "-", "0.5", ",", "false", ")", ";", "assertEquals", "(", "-", "TAN_0p5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"floor\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "assertEquals", "(", "0.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"ceiling\"", ",", "\"\"", ",", "0.5", ",", "false", ")", ";", "assertEquals", "(", "1.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arccos\"", ",", "\"\"", ",", "COS_0p5", ",", "false", ")", ";", "assertEquals", "(", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arcsin\"", ",", "\"\"", ",", "SIN_0p5", ",", "false", ")", ";", "assertEquals", "(", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arctan\"", ",", "\"\"", ",", "TAN_0p5", ",", "false", ")", ";", "assertEquals", "(", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arccos\"", ",", "\"\"", ",", "-", "COS_0p5", ",", "false", ")", ";", "assertEquals", "(", "Math", ".", "PI", "-", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arcsin\"", ",", "\"\"", ",", "-", "SIN_0p5", ",", "false", ")", ";", "assertEquals", "(", "-", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"arctan\"", ",", "\"\"", ",", "-", "TAN_0p5", ",", "false", ")", ";", "assertEquals", "(", "-", "0.5", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"power\"", ",", "\"\"", ",", "2", ",", "4", ",", "false", ")", ";", "assertEquals", "(", "16.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"power\"", ",", "\"\"", ",", "16", ",", "1.", "/", "4.", ",", "false", ")", ";", "assertEquals", "(", "2.0", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "instantiateFunction", "(", "\"pow\"", ",", "\"\"", ",", "2", ",", "4", ",", "true", ")", ";", "}", "public", "void", "testUpdate", "(", ")", "{", "updateExistingBlock", "(", "\"cos\"", ",", "0.5", ",", "COS_0p5", ")", ";", "updateExistingBlock", "(", "\"sin\"", ",", "0.5", ",", "SIN_0p5", ")", ";", "updateExistingBlock", "(", "\"tan\"", ",", "0.5", ",", "TAN_0p5", ")", ";", "updateExistingBlock", "(", "\"cos\"", ",", "-", "0.5", ",", "COS_0p5", ")", ";", "updateExistingBlock", "(", "\"sin\"", ",", "-", "0.5", ",", "-", "SIN_0p5", ")", ";", "updateExistingBlock", "(", "\"tan\"", ",", "-", "0.5", ",", "-", "TAN_0p5", ")", ";", "updateExistingBlock", "(", "\"floor\"", ",", "0.5", ",", "0.0", ")", ";", "updateExistingBlock", "(", "\"ceiling\"", ",", "0.5", ",", "1.0", ")", ";", "updateExistingBlock", "(", "\"arccos\"", ",", "COS_0p5", ",", "0.5", ")", ";", "updateExistingBlock", "(", "\"arcsin\"", ",", "SIN_0p5", ",", "0.5", ")", ";", "updateExistingBlock", "(", "\"arctan\"", ",", "TAN_0p5", ",", "0.5", ")", ";", "updateExistingBlock", "(", "\"arccos\"", ",", "-", "COS_0p5", ",", "Math", ".", "PI", "-", "0.5", ")", ";", "updateExistingBlock", "(", "\"arcsin\"", ",", "-", "SIN_0p5", ",", "-", "0.5", ")", ";", "updateExistingBlock", "(", "\"arctan\"", ",", "-", "TAN_0p5", ",", "-", "0.5", ")", ";", "}", "public", "void", "updateExistingBlock", "(", "String", "func", ",", "double", "arg", ",", "double", "expectedValue", ")", "{", "BlockMathConstant", "constBlk", "=", "getUpstreamConstBlk1", "(", ")", ";", "constBlk", ".", "setValue", "(", "arg", ")", ";", "try", "{", "_block", ".", "setFunction", "(", "func", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "try", "{", "_block", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "expectedValue", ",", "_block", ".", "getValue", "(", ")", ",", "EPS", ")", ";", "}", "protected", "BlockMathConstant", "getUpstreamConstBlk", "(", "int", "index", ")", "{", "Signal", "s", "=", "_block", ".", "getInput", "(", "index", "-", "1", ")", ";", "assertNotNull", "(", "s", ")", ";", "Block", "sourceBlk", "=", "s", ".", "getSource", "(", ")", ";", "assertNotNull", "(", "sourceBlk", ")", ";", "assertEquals", "(", "\"\"", ",", "sourceBlk", ".", "getType", "(", ")", ")", ";", "return", "(", "BlockMathConstant", ")", "sourceBlk", ";", "}", "protected", "BlockMathConstant", "getUpstreamConstBlk1", "(", ")", "{", "return", "this", ".", "getUpstreamConstBlk", "(", "1", ")", ";", "}", "protected", "BlockMathConstant", "getUpstreamConstBlk2", "(", ")", "{", "return", "this", ".", "getUpstreamConstBlk", "(", "2", ")", ";", "}", "public", "void", "testDescribeSelfWriter", "(", ")", "{", "try", "{", "_block", ".", "describeSelf", "(", "_writer", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "\"\"", "+", "\"\"", ",", "_writer", ".", "toString", "(", ")", ")", ";", "}", "protected", "void", "instantiateFunction", "(", "String", "func", ",", "String", "name", ",", "double", "argument", ",", "boolean", "expectException", ")", "{", "ArrayList", "<", "Double", ">", "args", "=", "new", "ArrayList", "<", "Double", ">", "(", ")", ";", "args", ".", "add", "(", "argument", ")", ";", "instantiateFunction", "(", "func", ",", "name", ",", "args", ",", "expectException", ")", ";", "}", "protected", "void", "instantiateFunction", "(", "String", "func", ",", "String", "name", ",", "double", "argument1", ",", "double", "argument2", ",", "boolean", "expectException", ")", "{", "ArrayList", "<", "Double", ">", "args", "=", "new", "ArrayList", "<", "Double", ">", "(", ")", ";", "args", ".", "add", "(", "argument1", ")", ";", "args", ".", "add", "(", "argument2", ")", ";", "instantiateFunction", "(", "func", ",", "name", ",", "args", ",", "expectException", ")", ";", "}", "protected", "void", "instantiateFunction", "(", "String", "func", ",", "String", "name", ",", "ArrayList", "<", "Double", ">", "args", ",", "boolean", "expectException", ")", "{", "instantiateFunction", "(", "func", ",", "name", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "args", ",", "expectException", ")", ";", "}", "protected", "void", "instantiateFunction", "(", "String", "func", ",", "String", "name", ",", "String", "funcAttributeName1", ",", "String", "funcAttributeValue1", ",", "String", "funcAttributeName2", ",", "String", "funcAttributeValue2", ",", "String", "extendedFunctionName", ",", "ArrayList", "<", "Double", ">", "args", ",", "boolean", "expectException", ")", "{", "Element", "argElement", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "Element", "funcElement", "=", "new", "Element", "(", "func", ")", ";", "applyElement", ".", "addContent", "(", "funcElement", ")", ";", "if", "(", "funcAttributeName1", "!=", "null", ")", "{", "funcElement", ".", "setAttribute", "(", "funcAttributeName1", ",", "funcAttributeValue1", ")", ";", "if", "(", "funcAttributeName2", "!=", "null", ")", "{", "funcElement", ".", "setAttribute", "(", "funcAttributeName2", ",", "funcAttributeValue2", ")", ";", "}", "if", "(", "extendedFunctionName", "!=", "null", ")", "{", "funcElement", ".", "addContent", "(", "extendedFunctionName", ")", ";", "}", "}", "Iterator", "<", "Double", ">", "it", "=", "args", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "argElement", "=", "new", "Element", "(", "\"cn\"", ")", ";", "argElement", ".", "addContent", "(", "it", ".", "next", "(", ")", ".", "toString", "(", ")", ")", ";", "applyElement", ".", "addContent", "(", "argElement", ")", ";", "}", "_block", "=", "null", ";", "_model", "=", "new", "Model", "(", "1", ",", "1", ")", ";", "try", "{", "if", "(", "\"csymbol\"", ".", "equals", "(", "func", ")", ")", "{", "_block", "=", "new", "BlockMathFunctionExtension", "(", "applyElement", ",", "_model", ")", ";", "}", "else", "{", "_block", "=", "new", "BlockMathFunction", "(", "applyElement", ",", "_model", ")", ";", "}", "if", "(", "expectException", ")", "fail", "(", "\"\"", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "if", "(", "expectException", ")", "{", "}", "else", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "!", "expectException", ")", "{", "assertNotNull", "(", "_block", ")", ";", "assertEquals", "(", "name", ",", "_block", ".", "getType", "(", ")", ")", ";", "if", "(", "extendedFunctionName", "==", "null", ")", "assertEquals", "(", "func", ",", "_block", ".", "getFuncType", "(", ")", ")", ";", "else", "assertEquals", "(", "extendedFunctionName", ",", "_block", ".", "getFuncType", "(", ")", ")", ";", "assertEquals", "(", "Double", ".", "NaN", ",", "_block", ".", "getValue", "(", ")", ")", ";", "try", "{", "_model", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", "</s>" ]
8,440
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "junit", ".", "framework", ".", "*", ";", "public", "class", "GeneralBlockTest", "extends", "TestCase", "{", "Model", "_simple", ";", "Model", "_complexMath", ";", "Signal", "mySignal", ";", "BlockMathConstant", "myConstBlock", ";", "@", "Override", "protected", "void", "setUp", "(", ")", "{", "_simple", "=", "new", "Model", "(", "3", ",", "3", ")", ";", "Model", "constModel", "=", "new", "Model", "(", "2", ",", "2", ")", ";", "myConstBlock", "=", "new", "BlockMathConstant", "(", "\"-3.45\"", ",", "constModel", ")", ";", "Element", "theValue", "=", "new", "Element", "(", "\"ci\"", ")", ";", "theValue", ".", "addContent", "(", "\"beta\"", ")", ";", "Element", "absElement", "=", "new", "Element", "(", "\"abs\"", ")", ";", "Element", "applyElement", "=", "new", "Element", "(", "\"apply\"", ")", ";", "applyElement", ".", "addContent", "(", "absElement", ")", ";", "applyElement", ".", "addContent", "(", "theValue", ")", ";", "Element", "mathElement", "=", "new", "Element", "(", "\"math\"", ")", ";", "mathElement", ".", "addContent", "(", "applyElement", ")", ";", "Element", "calcElement", "=", "new", "Element", "(", "\"calculation\"", ")", ";", "calcElement", ".", "addContent", "(", "mathElement", ")", ";", "Element", "descElement", "=", "new", "Element", "(", "\"description\"", ")", ";", "descElement", ".", "addContent", "(", "\"\"", ")", ";", "java", ".", "util", ".", "ArrayList", "<", "Element", ">", "list", "=", "new", "java", ".", "util", ".", "ArrayList", "<", "Element", ">", "(", "3", ")", ";", "list", ".", "add", "(", "descElement", ")", ";", "list", ".", "add", "(", "calcElement", ")", ";", "Element", "varDefElement", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "varDefElement", ".", "setContent", "(", "list", ")", ";", "varDefElement", ".", "setAttribute", "(", "\"name\"", ",", "\"absbeta\"", ")", ";", "varDefElement", ".", "setAttribute", "(", "\"varID\"", ",", "\"absbeta\"", ")", ";", "varDefElement", ".", "setAttribute", "(", "\"units\"", ",", "\"deg\"", ")", ";", "mySignal", "=", "new", "Signal", "(", "varDefElement", ",", "_simple", ")", ";", "varDefElement", ".", "removeChild", "(", "\"calculation\"", ")", ";", "descElement", ".", "addContent", "(", "\"\"", ")", ";", "varDefElement", ".", "setAttribute", "(", "\"name\"", ",", "\"beta\"", ")", ";", "varDefElement", ".", "setAttribute", "(", "\"varID\"", ",", "\"beta\"", ")", ";", "Signal", "ignored", "=", "new", "Signal", "(", "varDefElement", ",", "_simple", ")", ";", "_simple", ".", "wireBlocks", "(", ")", ";", "_simple", ".", "hookUpIO", "(", ")", ";", "}", "public", "static", "Test", "suite", "(", ")", "{", "return", "new", "TestSuite", "(", "GeneralBlockTest", ".", "class", ")", ";", "}", "public", "void", "testConstBlock", "(", ")", "{", "assertEquals", "(", "-", "3.45", ",", "myConstBlock", ".", "getValue", "(", ")", ")", ";", "}", "public", "void", "testSignal", "(", ")", "{", "assertEquals", "(", "\"absbeta\"", ",", "mySignal", ".", "getName", "(", ")", ")", ";", "assertEquals", "(", "\"deg\"", ",", "mySignal", ".", "getUnits", "(", ")", ")", ";", "}", "public", "void", "testRenameOutVarID", "(", ")", "{", "Block", "upstreamBlock", "=", "mySignal", ".", "getSource", "(", ")", ";", "assertTrue", "(", "upstreamBlock", "!=", "null", ")", ";", "assertEquals", "(", "\"absbeta\"", ",", "upstreamBlock", ".", "getOutputVarID", "(", ")", ")", ";", "mySignal", ".", "setVarID", "(", "\"newName\"", ")", ";", "upstreamBlock", ".", "renameOutVarID", "(", ")", ";", "assertEquals", "(", "\"newName\"", ",", "upstreamBlock", ".", "getOutputVarID", "(", ")", ")", ";", "}", "public", "void", "testModel", "(", ")", "{", "assertEquals", "(", "3", ",", "_simple", ".", "getNumBlocks", "(", ")", ")", ";", "assertEquals", "(", "0", ",", "_simple", ".", "getNumTables", "(", ")", ")", ";", "assertEquals", "(", "2", ",", "_simple", ".", "getNumSignals", "(", ")", ")", ";", "}", "public", "void", "testMathFunc", "(", ")", "{", "Model", "mathFuncModel", "=", "new", "Model", "(", "10", ",", "10", ")", ";", "Element", "input", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "input", ".", "setAttribute", "(", "\"name\"", ",", "\"X\"", ")", ";", "input", ".", "setAttribute", "(", "\"varID\"", ",", "\"X\"", ")", ";", "input", ".", "setAttribute", "(", "\"units\"", ",", "\"\"", ")", ";", "Signal", "ignored", "=", "new", "Signal", "(", "input", ",", "mathFuncModel", ")", ";", "Element", "X1", "=", "new", "Element", "(", "\"ci\"", ")", ";", "X1", ".", "addContent", "(", "\"X\"", ")", ";", "Element", "aTanX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "aTanX", ".", "addContent", "(", "new", "Element", "(", "\"arctan\"", ")", ")", ";", "aTanX", ".", "addContent", "(", "X1", ")", ";", "Element", "tanATanX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "tanATanX", ".", "addContent", "(", "new", "Element", "(", "\"tan\"", ")", ")", ";", "tanATanX", ".", "addContent", "(", "aTanX", ")", ";", "Element", "X2", "=", "new", "Element", "(", "\"ci\"", ")", ";", "X2", ".", "addContent", "(", "\"X\"", ")", ";", "Element", "cosX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "cosX", ".", "addContent", "(", "new", "Element", "(", "\"cos\"", ")", ")", ";", "cosX", ".", "addContent", "(", "X2", ")", ";", "Element", "aCosCosX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "aCosCosX", ".", "addContent", "(", "new", "Element", "(", "\"arccos\"", ")", ")", ";", "aCosCosX", ".", "addContent", "(", "cosX", ")", ";", "Element", "denom", "=", "new", "Element", "(", "\"apply\"", ")", ";", "denom", ".", "addContent", "(", "new", "Element", "(", "\"times\"", ")", ")", ";", "denom", ".", "addContent", "(", "aCosCosX", ")", ";", "denom", ".", "addContent", "(", "tanATanX", ")", ";", "Element", "X3", "=", "new", "Element", "(", "\"ci\"", ")", ";", "X3", ".", "addContent", "(", "\"X\"", ")", ";", "Element", "sinX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "sinX", ".", "addContent", "(", "new", "Element", "(", "\"sin\"", ")", ")", ";", "sinX", ".", "addContent", "(", "X3", ")", ";", "Element", "aSinSinX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "aSinSinX", ".", "addContent", "(", "new", "Element", "(", "\"arcsin\"", ")", ")", ";", "aSinSinX", ".", "addContent", "(", "sinX", ")", ";", "Element", "trig", "=", "new", "Element", "(", "\"apply\"", ")", ";", "trig", ".", "addContent", "(", "new", "Element", "(", "\"divide\"", ")", ")", ";", "trig", ".", "addContent", "(", "aSinSinX", ")", ";", "trig", ".", "addContent", "(", "denom", ")", ";", "Element", "X4", "=", "new", "Element", "(", "\"ci\"", ")", ";", "X4", ".", "addContent", "(", "\"X\"", ")", ";", "Element", "xToTheTrigPwr", "=", "new", "Element", "(", "\"apply\"", ")", ";", "xToTheTrigPwr", ".", "addContent", "(", "new", "Element", "(", "\"power\"", ")", ")", ";", "xToTheTrigPwr", ".", "addContent", "(", "X4", ")", ";", "xToTheTrigPwr", ".", "addContent", "(", "trig", ")", ";", "Element", "X5", "=", "new", "Element", "(", "\"ci\"", ")", ";", "X5", ".", "addContent", "(", "\"X\"", ")", ";", "Element", "negX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "negX", ".", "addContent", "(", "new", "Element", "(", "\"minus\"", ")", ")", ";", "negX", ".", "addContent", "(", "X5", ")", ";", "Element", "xToTheTrigPwrMinusX", "=", "new", "Element", "(", "\"apply\"", ")", ";", "xToTheTrigPwrMinusX", ".", "addContent", "(", "new", "Element", "(", "\"plus\"", ")", ")", ";", "xToTheTrigPwrMinusX", ".", "addContent", "(", "xToTheTrigPwr", ")", ";", "xToTheTrigPwrMinusX", ".", "addContent", "(", "negX", ")", ";", "Element", "math", "=", "new", "Element", "(", "\"math\"", ")", ";", "math", ".", "addContent", "(", "xToTheTrigPwrMinusX", ")", ";", "Element", "calc", "=", "new", "Element", "(", "\"calculation\"", ")", ";", "calc", ".", "addContent", "(", "math", ")", ";", "Element", "output", "=", "new", "Element", "(", "\"variableDef\"", ")", ";", "output", ".", "addContent", "(", "calc", ")", ";", "output", ".", "setAttribute", "(", "\"name\"", ",", "\"Y\"", ")", ";", "output", ".", "setAttribute", "(", "\"varID\"", ",", "\"Y\"", ")", ";", "output", ".", "setAttribute", "(", "\"units\"", ",", "\"\"", ")", ";", "Signal", "ignored2", "=", "new", "Signal", "(", "output", ",", "mathFuncModel", ")", ";", "mathFuncModel", ".", "wireBlocks", "(", ")", ";", "mathFuncModel", ".", "hookUpIO", "(", ")", ";", "VectorInfoArrayList", "inputs", "=", "null", ";", "VectorInfoArrayList", "outputs", "=", "null", ";", "try", "{", "inputs", "=", "mathFuncModel", ".", "getInputVector", "(", ")", ";", "outputs", "=", "mathFuncModel", ".", "getOutputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertNotNull", "(", "inputs", ")", ";", "assertEquals", "(", "1", ",", "inputs", ".", "size", "(", ")", ")", ";", "assertNotNull", "(", "outputs", ")", ";", "assertEquals", "(", "1", ",", "outputs", ".", "size", "(", ")", ")", ";", "VectorInfo", "theInput", "=", "(", "VectorInfo", ")", "inputs", ".", "get", "(", "0", ")", ";", "assertNotNull", "(", "theInput", ")", ";", "assertEquals", "(", "\"X\"", ",", "theInput", ".", "getName", "(", ")", ")", ";", "VectorInfo", "theOutput", "=", "(", "VectorInfo", ")", "outputs", ".", "get", "(", "0", ")", ";", "assertNotNull", "(", "theOutput", ")", ";", "assertEquals", "(", "\"Y\"", ",", "theOutput", ".", "getName", "(", ")", ")", ";", "theInput", ".", "setValue", "(", "0.5", ")", ";", "try", "{", "mathFuncModel", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "assertEquals", "(", "-", "0.25", ",", "theOutput", ".", "getValue", "(", ")", ",", "0.0000000001", ")", ";", "try", "{", "theInput", ".", "setValue", "(", "+", "1", ")", ";", "mathFuncModel", ".", "cycle", "(", ")", ";", "assertEquals", "(", "0", ",", "theOutput", ".", "getValue", "(", ")", ",", "0.0000000001", ")", ";", "theInput", ".", "setValue", "(", "+", "2", ")", ";", "mathFuncModel", ".", "cycle", "(", ")", ";", "assertEquals", "(", "-", "0.7812534", ",", "theOutput", ".", "getValue", "(", ")", ",", "0.0000001", ")", ";", "theInput", ".", "setValue", "(", "+", "3", ")", ";", "mathFuncModel", ".", "cycle", "(", ")", ";", "assertEquals", "(", "-", "1.9825658", ",", "theOutput", ".", "getValue", "(", ")", ",", "0.0000001", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "fail", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "junit", ".", "textui", ".", "TestRunner", ".", "run", "(", "suite", "(", ")", ")", ";", "}", "}", "</s>" ]
8,441
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Attribute", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "public", "class", "Signal", "{", "Model", "ourModel", ";", "String", "myName", ";", "String", "myVarID", ";", "String", "myUnits", ";", "String", "description", ";", "Block", "source", ";", "int", "sourcePort", ";", "BlockArrayList", "dests", ";", "ArrayList", "<", "Integer", ">", "destPorts", ";", "boolean", "hasIC", ";", "private", "String", "IC", ";", "private", "boolean", "isInput", ";", "private", "boolean", "isControl", ";", "private", "boolean", "isDisturbance", ";", "private", "boolean", "isState", ";", "private", "boolean", "isStateDeriv", ";", "private", "boolean", "isOutput", ";", "private", "boolean", "isStdAIAA", ";", "boolean", "verboseFlag", "=", "false", ";", "private", "boolean", "derived", "=", "false", ";", "private", "boolean", "defined", "=", "false", ";", "private", "boolean", "marked", "=", "false", ";", "private", "double", "lowerLim", "=", "Double", ".", "NEGATIVE_INFINITY", ";", "private", "double", "upperLim", "=", "Double", ".", "POSITIVE_INFINITY", ";", "public", "Signal", "(", ")", "{", "ourModel", "=", "null", ";", "myName", "=", "\"unnamed\"", ";", "myVarID", "=", "\"unnamed\"", ";", "myUnits", "=", "\"\"", ";", "source", "=", "null", ";", "sourcePort", "=", "0", ";", "description", "=", "\"\"", ";", "dests", "=", "null", ";", "destPorts", "=", "null", ";", "hasIC", "=", "false", ";", "IC", "=", "\"\"", ";", "isInput", "=", "false", ";", "isControl", "=", "false", ";", "isDisturbance", "=", "false", ";", "isState", "=", "false", ";", "isStateDeriv", "=", "false", ";", "isOutput", "=", "false", ";", "isStdAIAA", "=", "false", ";", "derived", "=", "false", ";", "defined", "=", "false", ";", "lowerLim", "=", "Double", ".", "NEGATIVE_INFINITY", ";", "upperLim", "=", "Double", ".", "POSITIVE_INFINITY", ";", "marked", "=", "false", ";", "}", "public", "Signal", "(", "String", "signalName", ",", "Model", "m", ")", "{", "this", "(", "signalName", ",", "Signal", ".", "toValidId", "(", "signalName", ")", ",", "\"unkn\"", ",", "1", ",", "m", ")", ";", "}", "public", "Signal", "(", "String", "signalName", ",", "String", "varID", ",", "String", "units", ",", "int", "numConnects", ",", "Model", "m", ")", "{", "this", "(", ")", ";", "ourModel", "=", "m", ";", "myName", "=", "signalName", ";", "if", "(", "signalName", "==", "null", ")", "myName", "=", "\"unnamed\"", ";", "myVarID", "=", "varID", ";", "if", "(", "varID", "==", "null", ")", "myVarID", "=", "\"\"", "+", "m", ".", "getNumSignals", "(", ")", ";", "myUnits", "=", "units", ";", "dests", "=", "new", "BlockArrayList", "(", "numConnects", ")", ";", "destPorts", "=", "new", "ArrayList", "<", "Integer", ">", "(", "numConnects", ")", ";", "m", ".", "add", "(", "this", ")", ";", "}", "public", "Signal", "(", "Element", "signalElement", ",", "Model", "m", ")", "{", "this", "(", "signalElement", ".", "getAttributeValue", "(", "\"name\"", ")", ",", "m", ")", ";", "String", "name", "=", "signalElement", ".", "getName", "(", ")", ";", "if", "(", "name", ".", "equals", "(", "\"apply\"", ")", ")", "{", "this", ".", "handleApply", "(", "signalElement", ",", "m", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "\"variableDef\"", ")", ")", "{", "myVarID", "=", "signalElement", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "myUnits", "=", "signalElement", ".", "getAttributeValue", "(", "\"units\"", ")", ";", "Attribute", "theIC", "=", "signalElement", ".", "getAttribute", "(", "\"initialValue\"", ")", ";", "if", "(", "theIC", "!=", "null", ")", "{", "this", ".", "hasIC", "=", "true", ";", "this", ".", "IC", "=", "theIC", ".", "getValue", "(", ")", ";", "}", "Attribute", "minVal", "=", "signalElement", ".", "getAttribute", "(", "\"minValue\"", ")", ";", "if", "(", "minVal", "!=", "null", ")", "{", "this", ".", "setLowerLimit", "(", "minVal", ".", "getValue", "(", ")", ")", ";", "}", "Attribute", "maxVal", "=", "signalElement", ".", "getAttribute", "(", "\"maxValue\"", ")", ";", "if", "(", "maxVal", "!=", "null", ")", "{", "this", ".", "setUpperLimit", "(", "maxVal", ".", "getValue", "(", ")", ")", ";", "}", "Element", "isInputElement", "=", "signalElement", ".", "getChild", "(", "\"isInput\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isControlElement", "=", "signalElement", ".", "getChild", "(", "\"isControl\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isDisturbanceElement", "=", "signalElement", ".", "getChild", "(", "\"\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isStateElement", "=", "signalElement", ".", "getChild", "(", "\"isState\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isStateDerivElement", "=", "signalElement", ".", "getChild", "(", "\"isStateDeriv\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isOutputElement", "=", "signalElement", ".", "getChild", "(", "\"isOutput\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "Element", "isStdAIAAElement", "=", "signalElement", ".", "getChild", "(", "\"isStdAIAA\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "if", "(", "isInputElement", "!=", "null", ")", "{", "this", ".", "isInput", "=", "true", ";", "}", "else", "{", "if", "(", "isControlElement", "!=", "null", ")", "{", "this", ".", "isControl", "=", "true", ";", "}", "else", "{", "if", "(", "isDisturbanceElement", "!=", "null", ")", "this", ".", "isDisturbance", "=", "true", ";", "}", "}", "if", "(", "isStateElement", "!=", "null", ")", "this", ".", "isState", "=", "true", ";", "if", "(", "isStateDerivElement", "!=", "null", ")", "this", ".", "isStateDeriv", "=", "true", ";", "if", "(", "isOutputElement", "!=", "null", ")", "this", ".", "isOutput", "=", "true", ";", "if", "(", "isStdAIAAElement", "!=", "null", ")", "this", ".", "isStdAIAA", "=", "true", ";", "this", ".", "description", "=", "signalElement", ".", "getChildTextNormalize", "(", "\"description\"", ",", "signalElement", ".", "getNamespace", "(", ")", ")", ";", "if", "(", "this", ".", "description", "==", "null", ")", "this", ".", "description", "=", "\"\"", ";", "this", ".", "handleCalculation", "(", "signalElement", ",", "m", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "name", "+", "\"", "element.\"", ")", ";", "}", "}", "protected", "static", "String", "toValidId", "(", "String", "input", ")", "{", "String", "output", "=", "\"\"", ";", "if", "(", "input", "!=", "null", ")", "output", "=", "input", ".", "replace", "(", "\"", "\"", ",", "\"_\"", ")", ";", "return", "output", ";", "}", "private", "void", "handleCalculation", "(", "Element", "theVarDefElement", ",", "Model", "m", ")", "{", "Element", "calc", "=", "theVarDefElement", ".", "getChild", "(", "\"calculation\"", ",", "theVarDefElement", ".", "getNamespace", "(", ")", ")", ";", "if", "(", "calc", "!=", "null", ")", "{", "if", "(", "verboseFlag", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "myName", "+", "\"...\"", ")", ";", "Element", "math", "=", "this", ".", "findMathMLChild", "(", "calc", ",", "\"math\"", ")", ";", "if", "(", "math", "!=", "null", ")", "{", "if", "(", "verboseFlag", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "Element", "apply", "=", "this", ".", "findMathMLChild", "(", "math", ",", "\"apply\"", ")", ";", "if", "(", "apply", "!=", "null", ")", "{", "if", "(", "verboseFlag", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "this", ".", "handleApply", "(", "apply", ",", "m", ")", ";", "}", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "myName", "+", "\"\"", ")", ";", "}", "}", "}", "private", "Element", "findMathMLChild", "(", "Element", "e", ",", "String", "elementType", ")", "{", "Namespace", "mathml", "=", "Namespace", ".", "getNamespace", "(", "\"\"", ",", "\"\"", ")", ";", "Element", "child", ";", "child", "=", "e", ".", "getChild", "(", "elementType", ",", "mathml", ")", ";", "if", "(", "child", "==", "null", ")", "child", "=", "e", ".", "getChild", "(", "elementType", ")", ";", "return", "child", ";", "}", "public", "Signal", "(", "Signal", "s", ")", "{", "this", "(", ")", ";", "this", ".", "ourModel", "=", "s", ".", "ourModel", ";", "this", ".", "myName", "=", "s", ".", "myName", ";", "this", ".", "myVarID", "=", "s", ".", "myVarID", ";", "this", ".", "myUnits", "=", "s", ".", "myUnits", ";", "this", ".", "source", "=", "s", ".", "source", ";", "this", ".", "sourcePort", "=", "s", ".", "sourcePort", ";", "this", ".", "hasIC", "=", "s", ".", "hasIC", ";", "this", ".", "IC", "=", "s", ".", "IC", ";", "this", ".", "lowerLim", "=", "s", ".", "lowerLim", ";", "this", ".", "upperLim", "=", "s", ".", "upperLim", ";", "this", ".", "isOutput", "=", "s", ".", "isOutput", ";", "this", ".", "derived", "=", "s", ".", "derived", ";", "this", ".", "dests", "=", "new", "BlockArrayList", "(", "s", ".", "dests", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Block", ">", "dest_iterator", "=", "s", ".", "dests", ".", "iterator", "(", ")", ";", "while", "(", "dest_iterator", ".", "hasNext", "(", ")", ")", "this", ".", "dests", ".", "add", "(", "dest_iterator", ".", "next", "(", ")", ")", ";", "this", ".", "destPorts", "=", "new", "ArrayList", "<", "Integer", ">", "(", "s", ".", "destPorts", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Integer", ">", "port_iterator", "=", "s", ".", "destPorts", ".", "iterator", "(", ")", ";", "while", "(", "port_iterator", ".", "hasNext", "(", ")", ")", "this", ".", "destPorts", ".", "add", "(", "port_iterator", ".", "next", "(", ")", ")", ";", "}", "public", "boolean", "sourceReady", "(", ")", "throws", "DAVEException", "{", "if", "(", "source", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", "source", ".", "isReady", "(", ")", ";", "}", "public", "double", "sourceValue", "(", ")", "throws", "DAVEException", "{", "if", "(", "source", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", "source", ".", "getValue", "(", ")", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verboseFlag", "=", "false", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verboseFlag", ";", "}", "private", "Block", "handleApply", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "Block", "b", "=", "BlockMath", ".", "factory", "(", "applyElement", ",", "m", ")", ";", "if", "(", "b", "==", "null", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "else", "{", "try", "{", "b", ".", "addOutput", "(", "this", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "b", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "return", "b", ";", "}", "public", "void", "setName", "(", "String", "theName", ")", "{", "this", ".", "myName", "=", "theName", ";", "}", "public", "void", "setUnits", "(", "String", "theUnits", ")", "{", "this", ".", "myUnits", "=", "theUnits", ";", "}", "public", "void", "setVarID", "(", "String", "theVarID", ")", "{", "this", ".", "myVarID", "=", "theVarID", ";", "if", "(", "this", ".", "source", "!=", "null", ")", "this", ".", "source", ".", "renameOutVarID", "(", ")", ";", "BlockArrayList", "sinks", "=", "this", ".", "getDests", "(", ")", ";", "ArrayList", "<", "Integer", ">", "sinkPorts", "=", "this", ".", "getDestPortNumbers", "(", ")", ";", "if", "(", "(", "sinks", "!=", "null", ")", "&&", "(", "sinkPorts", "!=", "null", ")", ")", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sinks", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Block", "blk", "=", "sinks", ".", "get", "(", "i", ")", ";", "blk", ".", "renameInVarID", "(", "sinkPorts", ".", "get", "(", "i", ")", ")", ";", "if", "(", "blk", "instanceof", "BlockBP", ")", "{", "Signal", "sig", "=", "blk", ".", "getOutput", "(", ")", ";", "sig", ".", "setVarID", "(", "theVarID", ")", ";", "}", "}", "}", "public", "void", "setDerivedFlag", "(", ")", "{", "this", ".", "derived", "=", "true", ";", "}", "public", "void", "clearDerivedFlag", "(", ")", "{", "this", ".", "derived", "=", "false", ";", "}", "public", "boolean", "isDerived", "(", ")", "{", "return", "this", ".", "derived", ";", "}", "protected", "void", "setDefinedFlag", "(", ")", "{", "this", ".", "defined", "=", "true", ";", "}", "protected", "void", "clearDefinedFlag", "(", ")", "{", "this", ".", "defined", "=", "false", ";", "}", "public", "boolean", "isDefined", "(", ")", "{", "return", "this", ".", "defined", ";", "}", "public", "void", "mark", "(", ")", "{", "this", ".", "marked", "=", "true", ";", "}", "public", "void", "unmark", "(", ")", "{", "this", ".", "marked", "=", "false", ";", "}", "public", "boolean", "isMarked", "(", ")", "{", "return", "this", ".", "marked", ";", "}", "boolean", "hasLowerLimit", "(", ")", "{", "return", "lowerLim", "!=", "Double", ".", "NEGATIVE_INFINITY", ";", "}", "boolean", "hasUpperLimit", "(", ")", "{", "return", "upperLim", "!=", "Double", ".", "POSITIVE_INFINITY", ";", "}", "boolean", "isLimited", "(", ")", "{", "return", "hasLowerLimit", "(", ")", "||", "hasUpperLimit", "(", ")", ";", "}", "protected", "final", "void", "setLowerLimit", "(", "String", "strValue", ")", "{", "lowerLim", "=", "Double", ".", "parseDouble", "(", "strValue", ")", ";", "}", "void", "setLowerLimit", "(", "double", "value", ")", "{", "lowerLim", "=", "value", ";", "}", "double", "getLowerLimit", "(", ")", "{", "return", "lowerLim", ";", "}", "protected", "final", "void", "setUpperLimit", "(", "String", "strValue", ")", "{", "upperLim", "=", "Double", ".", "parseDouble", "(", "strValue", ")", ";", "}", "void", "setUpperLimit", "(", "double", "value", ")", "{", "upperLim", "=", "value", ";", "}", "double", "getUpperLimit", "(", ")", "{", "return", "upperLim", ";", "}", "void", "clearIsOutputFlag", "(", ")", "{", "this", ".", "isOutput", "=", "false", ";", "}", "public", "void", "addSource", "(", "Block", "sourceBlock", ",", "int", "portNum", ")", "{", "source", "=", "sourceBlock", ";", "sourcePort", "=", "portNum", ";", "}", "public", "void", "addSink", "(", "Block", "sinkBlock", ",", "int", "portNum", ")", "{", "dests", ".", "add", "(", "sinkBlock", ")", ";", "destPorts", ".", "add", "(", "new", "Integer", "(", "portNum", ")", ")", ";", "sinkBlock", ".", "addInput", "(", "this", ",", "portNum", ")", ";", "}", "public", "BlockArrayList", "getDests", "(", ")", "{", "return", "this", ".", "dests", ";", "}", "public", "ArrayList", "<", "Integer", ">", "getDestPortNumbers", "(", ")", "{", "return", "this", ".", "destPorts", ";", "}", "public", "void", "setPortNumber", "(", "int", "portIndex", ",", "int", "newPortNumber", ")", "{", "destPorts", ".", "set", "(", "portIndex", ",", "new", "Integer", "(", "newPortNumber", ")", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "myName", ";", "}", "public", "String", "getVarID", "(", ")", "{", "return", "myVarID", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "myUnits", ";", "}", "public", "Block", "getSource", "(", ")", "{", "return", "source", ";", "}", "public", "int", "getSourcePort", "(", ")", "{", "return", "sourcePort", ";", "}", "public", "boolean", "hasSource", "(", ")", "{", "return", "(", "source", "!=", "null", ")", ";", "}", "public", "boolean", "hasDest", "(", ")", "{", "if", "(", "this", ".", "dests", "==", "null", ")", "return", "false", ";", "return", "(", "!", "dests", ".", "isEmpty", "(", ")", ")", ";", "}", "public", "void", "removeDestBlocks", "(", ")", "{", "if", "(", "this", ".", "dests", "!=", "null", ")", "this", ".", "dests", ".", "clear", "(", ")", ";", "if", "(", "this", ".", "destPorts", "!=", "null", ")", "this", ".", "destPorts", ".", "clear", "(", ")", ";", "}", "public", "boolean", "hasIC", "(", ")", "{", "return", "this", ".", "hasIC", ";", "}", "public", "String", "getIC", "(", ")", "{", "return", "this", ".", "IC", ";", "}", "public", "boolean", "isInput", "(", ")", "{", "return", "this", ".", "isInput", ";", "}", "public", "boolean", "isControl", "(", ")", "{", "return", "this", ".", "isControl", ";", "}", "public", "boolean", "isDisturbance", "(", ")", "{", "return", "this", ".", "isDisturbance", ";", "}", "public", "boolean", "isState", "(", ")", "{", "return", "this", ".", "isState", ";", "}", "public", "boolean", "isStateDeriv", "(", ")", "{", "return", "this", ".", "isStateDeriv", ";", "}", "public", "boolean", "isOutput", "(", ")", "{", "return", "this", ".", "isOutput", ";", "}", "public", "boolean", "isStdAIAA", "(", ")", "{", "return", "this", ".", "isStdAIAA", ";", "}", "public", "void", "setDescription", "(", "String", "newDescription", ")", "{", "this", ".", "description", "=", "newDescription", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "this", ".", "description", ";", "}", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "if", "(", "this", ".", "isDerived", "(", ")", ")", "{", "if", "(", "this", ".", "source", "!=", "null", ")", "{", "cvn", ".", "appendCode", "(", "\"(\"", ")", ";", "cvn", ".", "append", "(", "this", ".", "source", ".", "genCode", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "\")\"", ")", ";", "}", "}", "else", "{", "cvn", ".", "appendCode", "(", "this", ".", "getVarID", "(", ")", ")", ";", "cvn", ".", "addVarName", "(", "this", ".", "getVarID", "(", ")", ")", ";", "}", "if", "(", "this", ".", "source", "!=", "null", ")", "this", ".", "setDefinedFlag", "(", ")", ";", "return", "cvn", ";", "}", "public", "void", "describeSelf", "(", "FileWriter", "writer", ")", "throws", "IOException", "{", "int", "numDests", "=", "dests", ".", "size", "(", ")", ";", "Block", "outputBlock", ";", "Integer", "outputBPort", ";", "int", "thePortNum", ";", "writer", ".", "write", "(", "\"Signal", "\\\"\"", "+", "myName", "+", "\"\\\"", "(\"", "+", "myUnits", "+", "\")", "[\"", "+", "myVarID", "+", "\"]", "connects", "\"", ")", ";", "if", "(", "source", "==", "null", ")", "writer", ".", "write", "(", "\"\"", ")", ";", "else", "{", "writer", ".", "write", "(", "\"outport", "\"", "+", "sourcePort", "+", "\"", "of", "block", "\"", ")", ";", "writer", ".", "write", "(", "source", ".", "getName", "(", ")", "+", "\"", "to", "\"", ")", ";", "}", "switch", "(", "numDests", ")", "{", "case", "0", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "1", ":", "thePortNum", "=", "(", "destPorts", ".", "get", "(", "0", ")", ")", ".", "intValue", "(", ")", ";", "writer", ".", "write", "(", "\"inport", "\"", "+", "thePortNum", "+", "\"", "of", "block", "\"", ")", ";", "outputBlock", "=", "dests", ".", "get", "(", "0", ")", ";", "writer", ".", "write", "(", "outputBlock", ".", "getName", "(", ")", "+", "\".\"", ")", ";", "break", ";", "default", ":", "writer", ".", "write", "(", "\"\"", "+", "numDests", "+", "\"", "blocks:n\"", ")", ";", "Iterator", "<", "Block", ">", "outBlockIterator", "=", "dests", ".", "iterator", "(", ")", ";", "Iterator", "<", "Integer", ">", "outBPortIterator", "=", "destPorts", ".", "iterator", "(", ")", ";", "while", "(", "outBlockIterator", ".", "hasNext", "(", ")", ")", "{", "outputBlock", "=", "outBlockIterator", ".", "next", "(", ")", ";", "outputBPort", "=", "outBPortIterator", ".", "next", "(", ")", ";", "thePortNum", "=", "outputBPort", ".", "intValue", "(", ")", ";", "writer", ".", "write", "(", "\"", "inport", "\"", "+", "thePortNum", "+", "\"", "of", "block", "\"", "+", "outputBlock", ".", "getName", "(", ")", ")", ";", "if", "(", "outBlockIterator", ".", "hasNext", "(", ")", ")", "writer", ".", "write", "(", "\"n\"", ")", ";", "}", "}", "}", "}", "</s>" ]
8,442
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "public", "class", "BreakpointSet", "{", "String", "bpid", ";", "ArrayList", "<", "Double", ">", "bpValues", ";", "String", "myDescription", ";", "String", "myName", ";", "Model", "myModel", ";", "boolean", "verbose", ";", "BlockArrayList", "users", ";", "public", "BreakpointSet", "(", "Model", "m", ")", "{", "this", ".", "bpid", "=", "\"\"", ";", "this", ".", "bpValues", "=", "null", ";", "this", ".", "myDescription", "=", "\"\"", ";", "this", ".", "myName", "=", "\"\"", ";", "this", ".", "myModel", "=", "m", ";", "this", ".", "verbose", "=", "false", ";", "this", ".", "users", "=", "new", "BlockArrayList", "(", "3", ")", ";", "}", "public", "BreakpointSet", "(", "Element", "bpdef", ",", "Model", "m", ")", "throws", "DAVEException", "{", "this", "(", "m", ")", ";", "if", "(", "bpdef", ".", "getAttributeValue", "(", "\"name\"", ")", "!=", "null", ")", "this", ".", "myName", "=", "bpdef", ".", "getAttributeValue", "(", "\"name\"", ")", ";", "else", "this", ".", "myName", "=", "null", ";", "this", ".", "bpid", "=", "bpdef", ".", "getAttributeValue", "(", "\"bpID\"", ")", ";", "if", "(", "this", ".", "bpid", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", ")", ";", "m", ".", "register", "(", "this", ")", ";", "Namespace", "ns", "=", "null", ";", "Element", "parent", "=", "bpdef", ".", "getParentElement", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "ns", "=", "parent", ".", "getNamespace", "(", ")", ";", "Element", "descrip", "=", "bpdef", ".", "getChild", "(", "\"description\"", ",", "ns", ")", ";", "if", "(", "descrip", "!=", "null", ")", "this", ".", "myDescription", "=", "descrip", ".", "getTextTrim", "(", ")", ";", "else", "this", ".", "myDescription", "=", "null", ";", "this", ".", "users", "=", "new", "BlockArrayList", "(", "5", ")", ";", "Element", "set", "=", "bpdef", ".", "getChild", "(", "\"bpVals\"", ",", "ns", ")", ";", "try", "{", "this", ".", "bpValues", "=", "ParseText", ".", "toList", "(", "set", ".", "getTextTrim", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "bpid", ")", ";", "}", "if", "(", "this", ".", "bpValues", "==", "null", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "bpid", ")", ";", "}", "if", "(", "this", ".", "bpValues", ".", "size", "(", ")", "<", "1", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "bpid", ")", ";", "}", "}", "public", "BreakpointSet", "(", "String", "setName", ",", "String", "bpID", ",", "String", "setValues", ",", "String", "description", ",", "Model", "m", ")", "throws", "DAVEException", "{", "this", "(", "m", ")", ";", "this", ".", "myName", "=", "setName", ";", "this", ".", "myDescription", "=", "description", ";", "this", ".", "bpid", "=", "bpID", ";", "this", ".", "verbose", "=", "false", ";", "try", "{", "this", ".", "bpValues", "=", "ParseText", ".", "toList", "(", "setValues", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", ")", ";", "}", "m", ".", "register", "(", "this", ")", ";", "}", "public", "void", "register", "(", "BlockBP", "userBlockBP", ")", "{", "this", ".", "users", ".", "add", "(", "userBlockBP", ")", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verbose", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verbose", "=", "true", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verbose", "=", "false", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "myName", ";", "}", "public", "String", "getBPID", "(", ")", "{", "return", "this", ".", "bpid", ";", "}", "public", "int", "length", "(", ")", "{", "if", "(", "bpValues", "==", "null", ")", "return", "0", ";", "return", "this", ".", "bpValues", ".", "size", "(", ")", ";", "}", "public", "ArrayList", "<", "Double", ">", "values", "(", ")", "{", "return", "this", ".", "bpValues", ";", "}", "}", "</s>" ]
8,443
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "public", "class", "BlockInput", "extends", "Block", "{", "String", "units", ";", "public", "BlockInput", "(", "Signal", "theSignal", ",", "Model", "m", ")", "{", "super", "(", "theSignal", ".", "getName", "(", ")", ",", "\"input\"", ",", "0", ",", "m", ")", ";", "this", ".", "units", "=", "theSignal", ".", "getUnits", "(", ")", ";", "try", "{", "this", ".", "addOutput", "(", "theSignal", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "public", "void", "setInputValue", "(", "double", "theValue", ")", "{", "this", ".", "value", "=", "theValue", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "this", ".", "units", ";", "}", "public", "int", "getSeqNumber", "(", ")", "{", "BlockArrayList", "modelInputs", "=", "this", ".", "ourModel", ".", "getInputBlocks", "(", ")", ";", "return", "modelInputs", ".", "indexOf", "(", "this", ")", "+", "1", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "String", "code", "=", "\"\"", ";", "Signal", "theSignal", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "code", "+=", "outVarID", ";", "if", "(", "theSignal", ".", "isStdAIAA", "(", ")", ")", "code", "+=", "\"", "(\"", "+", "theSignal", ".", "getName", "(", ")", "+", "\")\"", ";", "code", "+=", "\"\"", ";", "if", "(", "units", ".", "equalsIgnoreCase", "(", "\"nd\"", ")", ")", "code", "+=", "\"\"", ";", "else", "code", "+=", "\"\"", "+", "units", "+", "\"'\"", ";", "}", "cvn", ".", "appendCode", "(", "this", ".", "wrapComment", "(", "code", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"", "(\"", "+", "units", "+", "\")\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "this", ".", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,444
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathProduct", "extends", "BlockMath", "{", "String", "blockType", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathProduct", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"product\"", ",", "m", ")", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "this", ".", "blockType", "=", "first", ".", "getName", "(", ")", ";", "this", ".", "setName", "(", "blockType", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "blockType", ".", "equals", "(", "\"times\"", ")", ")", "{", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "else", "if", "(", "blockType", ".", "equals", "(", "\"quotient\"", ")", ")", "{", "if", "(", "kids", ".", "size", "(", ")", "!=", "3", ")", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "kids", ".", "size", "(", ")", "-", "1", ")", ")", ";", "else", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "else", "if", "(", "blockType", ".", "equals", "(", "\"divide\"", ")", ")", "{", "if", "(", "kids", ".", "size", "(", ")", "!=", "3", ")", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "kids", ".", "size", "(", ")", "-", "1", ")", ")", ";", "else", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "blockType", ")", ";", "}", "}", "public", "String", "getBlockType", "(", ")", "{", "return", "this", ".", "blockType", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Iterator", "<", "Signal", ">", "inputSig", "=", "inputs", ".", "iterator", "(", ")", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "while", "(", "inputSig", ".", "hasNext", "(", ")", ")", "{", "Signal", "inSig", "=", "inputSig", ".", "next", "(", ")", ";", "cvn", ".", "append", "(", "inSig", ".", "genCode", "(", ")", ")", ";", "if", "(", "inputSig", ".", "hasNext", "(", ")", ")", "{", "if", "(", "this", ".", "blockType", ".", "equals", "(", "\"times\"", ")", ")", "cvn", ".", "appendCode", "(", "\"*\"", ")", ";", "else", "if", "(", "this", ".", "blockType", ".", "equals", "(", "\"divide\"", ")", ")", "cvn", ".", "appendCode", "(", "\"/\"", ")", ";", "else", "if", "(", "this", ".", "blockType", ".", "equals", "(", "\"quotient\"", ")", ")", "cvn", ".", "appendCode", "(", "\"/\"", ")", ";", "}", "}", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "Iterator", "<", "Signal", ">", "theInputs", ";", "double", "[", "]", "inputVals", ";", "Signal", "theInput", ";", "int", "index", "=", "0", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "inputVals", "=", "new", "double", "[", "this", ".", "inputs", ".", "size", "(", ")", "]", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "inputVals", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "inputVals", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "if", "(", "this", ".", "blockType", ".", "equals", "(", "\"times\"", ")", ")", "{", "this", ".", "value", "=", "1.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputVals", ".", "length", ";", "i", "++", ")", "this", ".", "value", "*=", "inputVals", "[", "i", "]", ";", "}", "else", "{", "this", ".", "value", "=", "inputVals", "[", "0", "]", "/", "inputVals", "[", "1", "]", ";", "}", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,445
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "public", "class", "BlockFuncTable", "extends", "Block", "{", "boolean", "simple", ";", "String", "gtID", ";", "FuncTable", "functionTableDef", ";", "String", "description", ";", "String", "functionDefName", ";", "Namespace", "ns", ";", "public", "BlockFuncTable", "(", "Element", "function", ",", "Model", "m", ")", "throws", "IOException", "{", "super", "(", "function", ".", "getAttributeValue", "(", "\"name\"", ")", ",", "\"\"", ",", "3", ",", "m", ")", ";", "this", ".", "ns", "=", "function", ".", "getNamespace", "(", ")", ";", "if", "(", "function", ".", "getChild", "(", "\"description\"", ",", "this", ".", "ns", ")", "!=", "null", ")", "this", ".", "description", "=", "function", ".", "getChild", "(", "\"description\"", ",", "this", ".", "ns", ")", ".", "getTextTrim", "(", ")", ";", "else", "this", ".", "description", "=", "\"\"", ";", "this", ".", "functionDefName", "=", "\"unnamed\"", ";", "if", "(", "function", ".", "getChild", "(", "\"functionDefn\"", ",", "this", ".", "ns", ")", "!=", "null", ")", "{", "this", ".", "simple", "=", "false", ";", "this", ".", "functionDefName", "=", "function", ".", "getChild", "(", "\"functionDefn\"", ",", "this", ".", "ns", ")", ".", "getAttributeValue", "(", "\"name\"", ")", ";", "if", "(", "this", ".", "functionDefName", "==", "null", ")", "{", "this", ".", "functionDefName", "=", "\"auto_fn_\"", "+", "this", ".", "ourModel", ".", "getNumBlocks", "(", ")", ";", "}", "this", ".", "setName", "(", "this", ".", "functionDefName", ")", ";", "Element", "gt", "=", "function", ".", "getChild", "(", "\"functionDefn\"", ",", "this", ".", "ns", ")", ".", "getChild", "(", "\"griddedTable\"", ",", "this", ".", "ns", ")", ";", "Element", "gtd", "=", "function", ".", "getChild", "(", "\"functionDefn\"", ",", "this", ".", "ns", ")", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "Element", "gtr", "=", "function", ".", "getChild", "(", "\"functionDefn\"", ",", "this", ".", "ns", ")", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "gt", "!=", "null", ")", "{", "String", "internalID", "=", "this", ".", "getName", "(", ")", "+", "\"\"", ";", "this", ".", "functionTableDef", "=", "new", "FuncTable", "(", "internalID", ",", "gt", ",", "m", ")", ";", "}", "else", "if", "(", "gtd", "!=", "null", ")", "{", "this", ".", "functionTableDef", "=", "new", "FuncTable", "(", "gtd", ",", "m", ")", ";", "}", "else", "if", "(", "gtr", "!=", "null", ")", "{", "this", ".", "gtID", "=", "gtr", ".", "getAttributeValue", "(", "\"gtID\"", ")", ";", "this", ".", "functionTableDef", "=", "this", ".", "ourModel", ".", "getTableByID", "(", "this", ".", "gtID", ")", ";", "if", "(", "this", ".", "functionTableDef", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "functionDefName", "+", "\"\"", "+", "this", ".", "gtID", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "functionDefName", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "functionTableDef", ".", "register", "(", "this", ")", ";", "parseVarIDsFromFunctionElement", "(", "function", ")", ";", "}", "else", "{", "this", ".", "simple", "=", "true", ";", "if", "(", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "myName", "+", "\"'\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "else", "parseSimpleFunction", "(", "function", ")", ";", "}", "hookUpOutput", "(", "function", ")", ";", "hookUpInputs", "(", ")", ";", "}", "public", "BlockFuncTable", "(", "BlockFuncTable", "b", ")", "{", "super", "(", "b", ")", ";", "this", ".", "simple", "=", "b", ".", "simple", ";", "this", ".", "gtID", "=", "b", ".", "gtID", ";", "this", ".", "functionTableDef", "=", "b", ".", "functionTableDef", ";", "this", ".", "description", "=", "b", ".", "description", ";", "this", ".", "functionDefName", "=", "b", ".", "functionDefName", ";", "}", "public", "FuncTable", "getFunctionTableDef", "(", ")", "{", "return", "this", ".", "functionTableDef", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "void", "parseSimpleFunction", "(", "Element", "function", ")", "throws", "IOException", "{", "Element", "outTable", "=", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "List", "<", "Element", ">", "iVarPts", "=", "function", ".", "getChildren", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "Iterator", "<", "Element", ">", "iVarPtsIterator", "=", "iVarPts", ".", "iterator", "(", ")", ";", "String", "funcTableName", "=", "\"auto_\"", "+", "this", ".", "myName", "+", "\"_table\"", ";", "this", ".", "functionTableDef", "=", "new", "FuncTable", "(", "funcTableName", ",", "funcTableName", ",", "outTable", ".", "getTextTrim", "(", ")", ",", "\"\"", ",", "iVarPts", ".", "size", "(", ")", ",", "ourModel", ")", ";", "if", "(", "this", ".", "functionTableDef", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "functionTableDef", ".", "register", "(", "this", ")", ";", "this", ".", "outVarID", "=", "outTable", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "int", "i", "=", "1", ";", "while", "(", "iVarPtsIterator", ".", "hasNext", "(", ")", ")", "{", "Element", "iVarPtsElement", "=", "iVarPtsIterator", ".", "next", "(", ")", ";", "String", "inVarID", "=", "iVarPtsElement", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "this", ".", "addVarID", "(", "i", ",", "inVarID", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inVarID", "+", "\"\"", "+", "this", ".", "functionDefName", ")", ";", "String", "bpName", "=", "\"auto_\"", "+", "this", ".", "myName", "+", "\"_bpID_\"", "+", "i", ";", "this", ".", "functionTableDef", ".", "addBPID", "(", "i", "-", "1", ",", "bpName", ")", ";", "Element", "inTable", "=", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "inTable", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "functionDefName", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "String", "bpDescription", "=", "new", "String", "(", "\"\"", "+", "this", ".", "getName", "(", ")", ")", ";", "try", "{", "new", "BreakpointSet", "(", "bpName", ",", "bpName", ",", "inTable", ".", "getTextTrim", "(", ")", ",", "bpDescription", ",", "this", ".", "ourModel", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "bpName", "+", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"':\"", ")", ";", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "bpName", "+", "\"\"", "+", "this", ".", "functionDefName", ")", ";", "i", "++", ";", "}", "this", ".", "functionTableDef", ".", "setDimensions", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "parseVarIDsFromFunctionElement", "(", "Element", "function", ")", "{", "List", "<", "Element", ">", "iVarRefs", "=", "function", ".", "getChildren", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "Iterator", "<", "Element", ">", "iVarRefIterator", "=", "iVarRefs", ".", "iterator", "(", ")", ";", "int", "i", "=", "0", ";", "while", "(", "iVarRefIterator", ".", "hasNext", "(", ")", ")", "{", "Element", "iVarRefElement", "=", "iVarRefIterator", ".", "next", "(", ")", ";", "String", "theVarID", "=", "iVarRefElement", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "this", ".", "addVarID", "(", "i", "+", "1", ",", "theVarID", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"Added", "varID", "\"", "+", "theVarID", ")", ";", "i", "++", ";", "}", "Element", "outVar", "=", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "this", ".", "outVarID", "=", "outVar", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "}", "protected", "String", "hookUpOutput", "(", "Element", "function", ")", "{", "Element", "depVar", "=", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "depVar", "==", "null", ")", "depVar", "=", "function", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "String", "depVarID", "=", "depVar", ".", "getAttributeValue", "(", "\"varID\"", ")", ";", "Iterator", "<", "Signal", ">", "sigIterator", "=", "this", ".", "ourModel", ".", "getSignals", "(", ")", ".", "iterator", "(", ")", ";", "boolean", "depVarSignalFound", "=", "false", ";", "Signal", "dVsig", "=", "null", ";", "while", "(", "sigIterator", ".", "hasNext", "(", ")", ")", "{", "dVsig", "=", "sigIterator", ".", "next", "(", ")", ";", "if", "(", "depVarID", ".", "equals", "(", "dVsig", ".", "getVarID", "(", ")", ")", ")", "{", "depVarSignalFound", "=", "true", ";", "break", ";", "}", "}", "if", "(", "!", "depVarSignalFound", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "depVarID", "+", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "try", "{", "this", ".", "addOutput", "(", "dVsig", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "depVarID", "+", "\"':\"", ")", ";", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "return", "dVsig", ".", "getName", "(", ")", ";", "}", "protected", "void", "createAndHookUpIWPath", "(", "String", "bpID", ",", "String", "varID", ",", "String", "iwSignalID", ",", "int", "portNum", ")", "{", "Signal", "connector", "=", "null", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "print", "(", "\"\"", "+", "varID", "+", "\"'...\"", ")", ";", "Signal", "theBPInputSignal", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "varID", ")", ";", "if", "(", "theBPInputSignal", "!=", "null", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"", "found", "it.\"", ")", ";", "String", "connectorName", "=", "theBPInputSignal", ".", "getName", "(", ")", "+", "\"_by_\"", "+", "bpID", ";", "String", "units", "=", "theBPInputSignal", ".", "getUnits", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "connectorName", "+", "\"\"", "+", "iwSignalID", "+", "\"\"", "+", "units", "+", "\"'\"", ")", ";", "connector", "=", "new", "Signal", "(", "connectorName", ",", "iwSignalID", ",", "units", ",", "2", ",", "ourModel", ")", ";", "connector", ".", "setDerivedFlag", "(", ")", ";", "connector", ".", "addSink", "(", "this", ",", "portNum", "+", "1", ")", ";", "}", "else", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "iwSignalID", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "try", "{", "new", "BlockBP", "(", "bpID", ",", "bpID", ",", "theBPInputSignal", ",", "connector", ",", "ourModel", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"':\"", ")", ";", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "protected", "void", "hookUpInputs", "(", ")", "{", "int", "portCount", "=", "0", ";", "Iterator", "<", "String", ">", "iVarIDIterator", "=", "this", ".", "getVarIDIterator", "(", ")", ";", "Iterator", "<", "String", ">", "bpIDIterator", "=", "this", ".", "functionTableDef", ".", "getBPIterator", "(", ")", ";", "String", "signalVarID", "=", "null", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "myName", ")", ";", "while", "(", "bpIDIterator", ".", "hasNext", "(", ")", ")", "{", "String", "bpID", "=", "bpIDIterator", ".", "next", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "print", "(", "\"\"", "+", "bpID", "+", "\"'\"", ")", ";", "if", "(", "!", "iVarIDIterator", ".", "hasNext", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"'\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "bpID", "+", "\"'.\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "else", "{", "signalVarID", "=", "iVarIDIterator", ".", "next", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "signalVarID", "+", "\"'\"", ")", ";", "}", "String", "iwSignalID", "=", "signalVarID", "+", "\"_x_\"", "+", "bpID", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "iwSignalID", "+", "\"'\"", ")", ";", "Signal", "theSignal", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "iwSignalID", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "theSignal", ".", "addSink", "(", "this", ",", "portCount", "+", "1", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "iwSignalID", "+", "\"\"", "+", "(", "portCount", "+", "1", ")", ")", ";", "}", "else", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"", "signal", "'\"", "+", "iwSignalID", "+", "\"\"", ")", ";", "createAndHookUpIWPath", "(", "bpID", ",", "signalVarID", ",", "iwSignalID", ",", "portCount", ")", ";", "}", "portCount", "++", ";", "}", "}", "public", "void", "reorderInputsForMDL", "(", ")", "{", "if", "(", "this", ".", "numInputs", "(", ")", ">", "2", ")", "{", "Iterator", "<", "Signal", ">", "theInputsIterator", "=", "this", ".", "getInputIterator", "(", ")", ";", "while", "(", "theInputsIterator", ".", "hasNext", "(", ")", ")", "{", "Signal", "theInput", "=", "theInputsIterator", ".", "next", "(", ")", ";", "BlockArrayList", "destBlocks", "=", "theInput", ".", "getDests", "(", ")", ";", "ArrayList", "<", "Integer", ">", "destPorts", "=", "theInput", ".", "getDestPortNumbers", "(", ")", ";", "Iterator", "<", "Block", ">", "destBlockIterator", "=", "destBlocks", ".", "iterator", "(", ")", ";", "Iterator", "<", "Integer", ">", "destPortIterator", "=", "destPorts", ".", "iterator", "(", ")", ";", "int", "thePortIndex", "=", "0", ";", "while", "(", "destBlockIterator", ".", "hasNext", "(", ")", ")", "{", "Block", "destBlock", "=", "destBlockIterator", ".", "next", "(", ")", ";", "Integer", "destPort", "=", "destPortIterator", ".", "next", "(", ")", ";", "if", "(", "destBlock", "==", "this", ")", "{", "int", "oldPortNumber", "=", "destPort", ".", "intValue", "(", ")", ";", "int", "newPortNumber", "=", "(", "this", ".", "numInputs", "(", ")", "+", "1", ")", "-", "oldPortNumber", ";", "if", "(", "oldPortNumber", "==", "(", "this", ".", "numInputs", "(", ")", "-", "1", ")", ")", "newPortNumber", "=", "1", ";", "if", "(", "oldPortNumber", "==", "(", "this", ".", "numInputs", "(", ")", ")", ")", "newPortNumber", "=", "2", ";", "theInput", ".", "setPortNumber", "(", "thePortIndex", ",", "newPortNumber", ")", ";", "}", "thePortIndex", "++", ";", "}", "}", "}", "}", "public", "void", "printTable", "(", "Writer", "writer", ")", "throws", "IOException", "{", "FuncTable", "gft", "=", "this", ".", "getFunctionTableDef", "(", ")", ";", "if", "(", "gft", "!=", "null", ")", "gft", ".", "printTable", "(", "writer", ")", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", "+", "this", ".", "functionTableDef", ".", "size", "(", ")", "+", "\"\"", ")", ";", "}", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "int", "numInputs", ";", "Iterator", "<", "Signal", ">", "theInputs", ";", "Signal", "theInput", ";", "double", "[", "]", "iwv", ";", "int", "[", "]", "iv", ";", "int", "index", "=", "0", ";", "boolean", "ready", "=", "true", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "numInputs", "=", "this", ".", "inputs", ".", "size", "(", ")", ";", "if", "(", "numInputs", "!=", "this", ".", "functionTableDef", ".", "numDim", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "iwv", "=", "new", "double", "[", "numInputs", "]", ";", "iv", "=", "new", "int", "[", "numInputs", "]", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "inputs", ".", "size", "(", ")", ")", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "ready", "=", "false", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "iwv", "[", "index", "]", "=", "0.0", ";", "iv", "[", "index", "]", "=", "0", ";", "}", "else", "{", "iwv", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "iv", "[", "index", "]", "=", "(", "int", ")", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#", "\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "iwv", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "if", "(", "!", "ready", ")", "return", ";", "this", ".", "value", "=", "this", ".", "interpolate", "(", "iwv", ",", "iv", ",", "numInputs", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "value", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "private", "double", "interpolate", "(", "double", "[", "]", "index_and_weights", ",", "int", "[", "]", "indices", ",", "int", "interpDimension", ")", "{", "int", "select", ";", "double", "weight", ";", "double", "a", ";", "double", "b", ";", "double", "value", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", "+", "interpDimension", ")", ";", "}", "select", "=", "indices", ".", "length", "-", "interpDimension", ";", "if", "(", "indices", "[", "select", "]", ">=", "(", "this", ".", "functionTableDef", ".", "dim", "(", "select", ")", "-", "1", ")", ")", "{", "indices", "[", "select", "]", "--", ";", "weight", "=", "1.0", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "interpDimension", ")", ";", "}", "else", "weight", "=", "index_and_weights", "[", "select", "]", "-", "(", "double", ")", "indices", "[", "select", "]", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "For", "dim", "\"", "+", "interpDimension", "+", "\"\"", "+", "select", "+", "\"\"", "+", "indices", "[", "select", "]", "+", "\"\"", "+", "weight", ")", ";", "if", "(", "interpDimension", "==", "1", ")", "{", "a", "=", "this", ".", "functionTableDef", ".", "getPt", "(", "indices", ")", ";", "indices", "[", "select", "]", "++", ";", "b", "=", "this", ".", "functionTableDef", ".", "getPt", "(", "indices", ")", ";", "indices", "[", "select", "]", "--", ";", "}", "else", "{", "a", "=", "this", ".", "interpolate", "(", "index_and_weights", ",", "indices", ",", "interpDimension", "-", "1", ")", ";", "indices", "[", "select", "]", "++", ";", "b", "=", "this", ".", "interpolate", "(", "index_and_weights", ",", "indices", ",", "interpDimension", "-", "1", ")", ";", "indices", "[", "select", "]", "--", ";", "}", "value", "=", "a", "+", "(", "b", "-", "a", ")", "*", "weight", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "a", "+", "\"", "and", "\"", "+", "b", "+", "\"", "is", "value", "\"", "+", "value", ")", ";", "return", "value", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "description", ".", "replaceAll", "(", "System", ".", "getProperty", "(", "\"\"", ")", ",", "\"", "\"", ")", ";", "}", "}", "</s>" ]
8,446
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "abstract", "public", "class", "Block", "{", "Model", "ourModel", ";", "String", "myName", ";", "String", "myType", ";", "NameList", "nameList", ";", "private", "ArrayList", "<", "String", ">", "inVarIDs", ";", "SignalArrayList", "inputs", ";", "protected", "String", "outVarID", ";", "private", "Signal", "output", ";", "protected", "int", "resultsCycleCount", ";", "double", "value", ";", "boolean", "verboseFlag", ";", "protected", "boolean", "selectedFlag", ";", "Object", "mask", ";", "public", "Block", "(", ")", "{", "this", ".", "ourModel", "=", "null", ";", "this", ".", "myName", "=", "null", ";", "this", ".", "myType", "=", "\"not", "defined\"", ";", "this", ".", "nameList", "=", "null", ";", "this", ".", "output", "=", "null", ";", "this", ".", "inVarIDs", "=", "new", "ArrayList", "<", "String", ">", "(", "1", ")", ";", "this", ".", "inputs", "=", "new", "SignalArrayList", "(", "1", ")", ";", "this", ".", "resultsCycleCount", "=", "-", "1", ";", "this", ".", "value", "=", "Double", ".", "NaN", ";", "this", ".", "verboseFlag", "=", "false", ";", "this", ".", "selectedFlag", "=", "true", ";", "this", ".", "mask", "=", "null", ";", "}", "public", "Block", "(", "Model", "m", ")", "{", "this", "(", ")", ";", "this", ".", "ourModel", "=", "m", ";", "m", ".", "add", "(", "this", ")", ";", "}", "public", "Block", "(", "String", "blockName", ",", "String", "blockType", ",", "int", "numInputs", ",", "Model", "m", ")", "{", "this", "(", ")", ";", "this", ".", "ourModel", "=", "m", ";", "this", ".", "myName", "=", "blockName", ";", "this", ".", "myType", "=", "blockType", ";", "this", ".", "inVarIDs", "=", "new", "ArrayList", "<", "String", ">", "(", "numInputs", ")", ";", "this", ".", "inputs", "=", "new", "SignalArrayList", "(", "numInputs", ")", ";", "m", ".", "add", "(", "this", ")", ";", "}", "public", "Block", "(", "Block", "b", ")", "{", "this", "(", ")", ";", "this", ".", "ourModel", "=", "b", ".", "getModel", "(", ")", ";", "this", ".", "myName", "=", "b", ".", "getName", "(", ")", ";", "this", ".", "myType", "=", "b", ".", "getType", "(", ")", ";", "this", ".", "nameList", "=", "b", ".", "nameList", ";", "this", ".", "inVarIDs", "=", "b", ".", "inVarIDs", ";", "this", ".", "inputs", "=", "b", ".", "inputs", ";", "this", ".", "outVarID", "=", "b", ".", "outVarID", ";", "this", ".", "output", "=", "b", ".", "output", ";", "}", "protected", "double", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "boolean", "isReady", "(", ")", "{", "return", "ourModel", ".", "getCycleCounter", "(", ")", "==", "this", ".", "resultsCycleCount", ";", "}", "public", "boolean", "allInputsConnected", "(", ")", "{", "boolean", "answer", "=", "true", ";", "Iterator", "<", "Signal", ">", "it", "=", "this", ".", "getInputIterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", "&&", "answer", ")", "{", "answer", "=", "answer", "&&", "(", "it", ".", "next", "(", ")", "!=", "null", ")", ";", "}", "return", "answer", ";", "}", "public", "boolean", "outputConnected", "(", ")", "{", "return", "(", "this", ".", "output", "!=", "null", ")", ";", "}", "public", "boolean", "allInputsReady", "(", ")", "{", "boolean", "allReady", "=", "true", ";", "Iterator", "<", "Signal", ">", "sigIt", "=", "this", ".", "getInputIterator", "(", ")", ";", "while", "(", "sigIt", ".", "hasNext", "(", ")", ")", "try", "{", "allReady", "=", "allReady", "&&", "sigIt", ".", "next", "(", ")", ".", "sourceReady", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "return", "allReady", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verboseFlag", "=", "false", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verboseFlag", ";", "}", "public", "void", "select", "(", ")", "{", "selectedFlag", "=", "true", ";", "}", "public", "void", "selectWithAncestors", "(", ")", "{", "this", ".", "select", "(", ")", ";", "Iterator", "<", "Signal", ">", "sigIt", "=", "this", ".", "getInputIterator", "(", ")", ";", "while", "(", "sigIt", ".", "hasNext", "(", ")", ")", "{", "Signal", "sig", "=", "sigIt", ".", "next", "(", ")", ";", "Block", "ancestor", "=", "sig", ".", "getSource", "(", ")", ";", "if", "(", "ancestor", "!=", "null", ")", "ancestor", ".", "selectWithAncestors", "(", ")", ";", "}", "}", "public", "void", "deselect", "(", ")", "{", "selectedFlag", "=", "false", ";", "}", "public", "boolean", "isSelected", "(", ")", "{", "return", "selectedFlag", ";", "}", "public", "void", "setMask", "(", "Object", "o", ")", "{", "this", ".", "mask", "=", "o", ";", "}", "public", "Object", "getMask", "(", ")", "{", "return", "this", ".", "mask", ";", "}", "public", "int", "addInput", "(", "Signal", "inSignal", ")", "{", "int", "portIndex", ";", "inputs", ".", "add", "(", "inSignal", ")", ";", "portIndex", "=", "inputs", ".", "indexOf", "(", "inSignal", ")", ";", "while", "(", "inVarIDs", ".", "size", "(", ")", "<=", "portIndex", ")", "inVarIDs", ".", "add", "(", "inSignal", ".", "getName", "(", ")", ")", ";", "String", "existingID", "=", "inVarIDs", ".", "get", "(", "portIndex", ")", ";", "if", "(", "existingID", ".", "equals", "(", "\"\"", ")", ")", "inVarIDs", ".", "set", "(", "portIndex", ",", "inSignal", ".", "getVarID", "(", ")", ")", ";", "return", "portIndex", "+", "1", ";", "}", "public", "void", "addInput", "(", "Signal", "inSignal", ",", "int", "portNum", ")", "{", "int", "portIndex", "=", "portNum", "-", "1", ";", "while", "(", "inputs", ".", "size", "(", ")", "<=", "portIndex", ")", "inputs", ".", "add", "(", "inSignal", ")", ";", "inputs", ".", "set", "(", "portIndex", ",", "inSignal", ")", ";", "while", "(", "inVarIDs", ".", "size", "(", ")", "<=", "portIndex", ")", "inVarIDs", ".", "add", "(", "\"\"", ")", ";", "String", "existingID", "=", "inVarIDs", ".", "get", "(", "portIndex", ")", ";", "if", "(", "existingID", ".", "equals", "(", "\"\"", ")", ")", "inVarIDs", ".", "set", "(", "portIndex", ",", "inSignal", ".", "getVarID", "(", ")", ")", ";", "}", "public", "void", "addVarID", "(", "int", "portNum", ",", "String", "varID", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "varID", "+", "\"'", "to", "port", "\"", "+", "portNum", "+", "\"", "of", "block", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "int", "portIndex", "=", "portNum", "-", "1", ";", "if", "(", "portNum", "<", "1", ")", "System", ".", "err", ".", "println", "(", "\"Block", "'\"", "+", "getName", "(", ")", "+", "\"\"", "+", "varID", "+", "\"'", "to", "port", "\"", "+", "portNum", "+", "\"", "--", "error!\"", ")", ";", "else", "{", "while", "(", "inVarIDs", ".", "size", "(", ")", "<=", "portIndex", ")", "inVarIDs", ".", "add", "(", "\"\"", ")", ";", "inVarIDs", ".", "set", "(", "portIndex", ",", "varID", ")", ";", "while", "(", "inputs", ".", "size", "(", ")", "<=", "portIndex", ")", "inputs", ".", "add", "(", "null", ")", ";", "inputs", ".", "set", "(", "portIndex", ",", "null", ")", ";", "}", "}", "public", "void", "replaceInput", "(", "Signal", "oldSignal", ",", "Signal", "newSignal", ")", "{", "while", "(", "inputs", ".", "contains", "(", "oldSignal", ")", ")", "{", "int", "oldSignalIndex", "=", "inputs", ".", "indexOf", "(", "oldSignal", ")", ";", "if", "(", "oldSignalIndex", ">=", "0", ")", "{", "inputs", ".", "remove", "(", "oldSignalIndex", ")", ";", "inputs", ".", "add", "(", "oldSignalIndex", ",", "newSignal", ")", ";", "}", "}", "}", "public", "void", "addOutput", "(", "Signal", "outSignal", ")", "throws", "DAVEException", "{", "String", "newVarID", "=", "outSignal", ".", "getVarID", "(", ")", ";", "if", "(", "this", ".", "outVarID", "==", "null", ")", "this", ".", "outVarID", "=", "newVarID", ";", "else", "if", "(", "!", "this", ".", "outVarID", ".", "equals", "(", "newVarID", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "newVarID", "+", "\"\"", "+", "this", ".", "outVarID", "+", "\"'.\"", ")", ";", "this", ".", "output", "=", "outSignal", ";", "outSignal", ".", "addSource", "(", "this", ",", "1", ")", ";", "}", "public", "void", "addOutput", "(", "String", "outVarID", ")", "{", "this", ".", "outVarID", "=", "outVarID", ";", "}", "protected", "void", "addInput", "(", "Block", "blk", ",", "int", "inPort", ")", "{", "Signal", "sig", ";", "if", "(", "blk", ".", "outputConnected", "(", ")", ")", "{", "sig", "=", "blk", ".", "output", ";", "}", "else", "{", "sig", "=", "new", "Signal", "(", "blk", ".", "getName", "(", ")", ",", "this", ".", "ourModel", ")", ";", "sig", ".", "setDerivedFlag", "(", ")", ";", "try", "{", "blk", ".", "addOutput", "(", "sig", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "blk", ".", "getName", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "sig", ".", "addSink", "(", "this", ",", "inPort", ")", ";", "}", "}", "protected", "void", "addConstInput", "(", "String", "constantValue", ",", "int", "inPort", ")", "{", "Block", "constBlock", "=", "new", "BlockMathConstant", "(", "constantValue", ",", "ourModel", ")", ";", "this", ".", "addInput", "(", "constBlock", ",", "inPort", ")", ";", "Signal", "derivedConst", "=", "constBlock", ".", "getOutput", "(", ")", ";", "derivedConst", ".", "setDerivedFlag", "(", ")", ";", "}", "public", "Model", "getModel", "(", ")", "{", "return", "this", ".", "ourModel", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "myName", ";", "}", "public", "String", "getType", "(", ")", "{", "return", "this", ".", "myType", ";", "}", "public", "String", "getVarID", "(", "int", "portNum", ")", "{", "return", "inVarIDs", ".", "get", "(", "portNum", "-", "1", ")", ";", "}", "public", "Iterator", "<", "Signal", ">", "getInputIterator", "(", ")", "{", "return", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "}", "public", "Signal", "getInput", "(", "int", "index", ")", "{", "return", "inputs", ".", "get", "(", "index", ")", ";", "}", "public", "Signal", "getOutput", "(", ")", "{", "return", "this", ".", "output", ";", "}", "public", "Iterator", "<", "String", ">", "getVarIDIterator", "(", ")", "{", "return", "this", ".", "inVarIDs", ".", "iterator", "(", ")", ";", "}", "public", "String", "getOutputVarID", "(", ")", "{", "return", "this", ".", "outVarID", ";", "}", "public", "void", "setNameList", "(", "NameList", "newNameList", ")", "{", "this", ".", "nameList", "=", "newNameList", ";", "this", ".", "setName", "(", "this", ".", "getName", "(", ")", ")", ";", "}", "protected", "void", "setName", "(", "String", "newName", ")", "{", "if", "(", "this", ".", "nameList", "!=", "null", ")", "this", ".", "myName", "=", "this", ".", "nameList", ".", "addUnique", "(", "newName", ")", ";", "else", "this", ".", "myName", "=", "newName", ";", "}", "public", "void", "renameOutVarID", "(", ")", "{", "this", ".", "outVarID", "=", "this", ".", "output", ".", "getVarID", "(", ")", ";", "}", "public", "void", "renameInVarID", "(", "Integer", "portNum", ")", "{", "Signal", "input", "=", "this", ".", "inputs", ".", "get", "(", "portNum", "-", "1", ")", ";", "String", "newVarID", "=", "input", ".", "myVarID", ";", "this", ".", "inVarIDs", ".", "set", "(", "portNum", "-", "1", ",", "newVarID", ")", ";", "}", "public", "int", "numInputs", "(", ")", "{", "if", "(", "this", ".", "inputs", "!=", "null", ")", "return", "this", ".", "inputs", ".", "size", "(", ")", ";", "else", "return", "0", ";", "}", "public", "int", "numVarIDs", "(", ")", "{", "return", "this", ".", "inVarIDs", ".", "size", "(", ")", ";", "}", "protected", "boolean", "hookUpInput", "(", "int", "port", ")", "throws", "DAVEException", "{", "String", "signalVarID", "=", "inVarIDs", ".", "get", "(", "port", "-", "1", ")", ";", "Signal", "theSignal", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "signalVarID", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "theSignal", ".", "addSink", "(", "this", ",", "port", ")", ";", "return", "true", ";", "}", "else", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "signalVarID", "+", "\"\"", "+", "port", "+", "\"", "of", "block", "\"", "+", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "}", "protected", "void", "hookUpInputs", "(", ")", "{", "int", "portCount", "=", "0", ";", "Iterator", "<", "String", ">", "iVarIDIterator", "=", "this", ".", "inVarIDs", ".", "iterator", "(", ")", ";", "while", "(", "iVarIDIterator", ".", "hasNext", "(", ")", ")", "{", "String", "signalVarID", "=", "iVarIDIterator", ".", "next", "(", ")", ";", "Signal", "theSignal", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "signalVarID", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "theSignal", ".", "addSink", "(", "this", ",", "portCount", "+", "1", ")", ";", "portCount", "++", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "signalVarID", "+", "\"", "found.\"", ")", ";", "}", "}", "}", "public", "void", "hookUp", "(", ")", "throws", "DAVEException", "{", "Iterator", "<", "Signal", ">", "it", ";", "int", "i", ";", "boolean", "result", ";", "Signal", "s", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "it", "=", "this", ".", "getInputIterator", "(", ")", ";", "i", "=", "1", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "s", "=", "it", ".", "next", "(", ")", ";", "if", "(", "s", "==", "null", ")", "{", "result", "=", "hookUpInput", "(", "i", ")", ";", "if", "(", "!", "result", ")", "{", "String", "inputSignalVarID", "=", "inVarIDs", ".", "get", "(", "i", "-", "1", ")", ";", "throw", "new", "DAVEException", "(", "\"\"", "+", "inputSignalVarID", "+", "\"'", "for", "input\"", ")", ";", "}", "}", "i", "++", ";", "}", "s", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "s", "==", "null", ")", "{", "if", "(", "this", ".", "outVarID", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"Block", "'\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "s", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "this", ".", "outVarID", ")", ";", "if", "(", "s", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "outVarID", "+", "\"'", "for", "output\"", ")", ";", "this", ".", "addOutput", "(", "s", ")", ";", "}", "}", "public", "boolean", "verifyInputs", "(", ")", "{", "boolean", "error", "=", "false", ";", "if", "(", "inVarIDs", ".", "size", "(", ")", "<", "inputs", ".", "size", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"In", "block", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "inVarIDs", ".", "size", "(", ")", ">", "inputs", ".", "size", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"In", "block", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "Iterator", "<", "Signal", ">", "ii", "=", "this", ".", "getInputIterator", "(", ")", ";", "int", "i", "=", "1", ";", "while", "(", "ii", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "ii", ".", "next", "(", ")", ";", "if", "(", "s", "==", "null", ")", "{", "try", "{", "error", "=", "error", "||", "!", "this", ".", "hookUpInput", "(", "i", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "i", "++", ";", "}", "}", "return", "error", ";", "}", "public", "boolean", "verifyOutputs", "(", ")", "{", "Signal", "s", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "s", "==", "null", ")", "{", "String", "theOutVarID", "=", "this", ".", "getOutputVarID", "(", ")", ";", "if", "(", "theOutVarID", "==", "null", ")", "return", "false", ";", "else", "{", "s", "=", "ourModel", ".", "getSignals", "(", ")", ".", "findByID", "(", "theOutVarID", ")", ";", "try", "{", "this", ".", "addOutput", "(", "s", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "theOutVarID", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "}", "return", "(", "s", "==", "null", ")", ";", "}", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "return", "new", "CodeAndVarNames", "(", "wrapComment", "(", "\"WARNING", "--", "\"", "+", "\"\"", "+", "outVarID", "+", "\"\"", "+", "this", ".", "myType", "+", "\"\\\"\"", ")", ")", ";", "}", "public", "String", "indent", "(", ")", "{", "String", "indent", "=", "\"\"", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "switch", "(", "dialect", ")", "{", "case", "Model", ".", "DT_ANSI_C", ":", "indent", "=", "\"", "\"", ";", "break", ";", "case", "Model", ".", "DT_FORTRAN", ":", "indent", "=", "\"", "\"", ";", "break", ";", "}", "return", "indent", ";", "}", "public", "String", "wrapComment", "(", "String", "comment", ")", "{", "String", "wrappedComment", "=", "\"\"", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "switch", "(", "dialect", ")", "{", "case", "Model", ".", "DT_ANSI_C", ":", "wrappedComment", "=", "\"/*", "\"", "+", "comment", "+", "\"", "*/\"", ";", "break", ";", "case", "Model", ".", "DT_FORTRAN", ":", "wrappedComment", "=", "\"!", "\"", "+", "comment", ";", "break", ";", "}", "wrappedComment", "+=", "\"n\"", ";", "return", "wrappedComment", ";", "}", "public", "String", "errorComment", "(", "String", "errMsg", ")", "{", "return", "this", ".", "wrapComment", "(", "\"ERROR:", "\"", "+", "errMsg", ")", ";", "}", "public", "String", "endLine", "(", ")", "{", "String", "lineEnd", "=", "\"n\"", ";", "if", "(", "ourModel", ".", "getCodeDialect", "(", ")", "==", "Model", ".", "DT_ANSI_C", ")", "lineEnd", "=", "\";n\"", ";", "return", "lineEnd", ";", "}", "public", "String", "beginIf", "(", "String", "condition", ")", "{", "String", "ifStart", "=", "\"\"", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "switch", "(", "dialect", ")", "{", "case", "Model", ".", "DT_ANSI_C", ":", "ifStart", "=", "indent", "(", ")", "+", "\"if", "(", "\"", "+", "condition", "+", "\"", ")", "{n\"", ";", "break", ";", "case", "Model", ".", "DT_FORTRAN", ":", "ifStart", "=", "indent", "(", ")", "+", "\"IF(", "\"", "+", "condition", "+", "\"", ")", "THENn\"", ";", "break", ";", "}", "return", "ifStart", ";", "}", "public", "String", "endIf", "(", ")", "{", "String", "ifEnd", "=", "\"\"", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "switch", "(", "dialect", ")", "{", "case", "Model", ".", "DT_ANSI_C", ":", "ifEnd", "=", "indent", "(", ")", "+", "\"}n\"", ";", "break", ";", "case", "Model", ".", "DT_FORTRAN", ":", "ifEnd", "=", "indent", "(", ")", "+", "\"ENDIFn\"", ";", "break", ";", "}", "return", "ifEnd", ";", "}", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "int", "numInputs", "=", "inputs", ".", "size", "(", ")", ";", "int", "numOutputs", "=", "0", ";", "if", "(", "this", ".", "output", "!=", "null", ")", "numOutputs", "=", "1", ";", "writer", ".", "write", "(", "\"Block", "\\\"\"", "+", "myName", "+", "\"\\\"", "has", "\"", ")", ";", "switch", "(", "numInputs", ")", "{", "case", "0", ":", "writer", ".", "write", "(", "\"NO", "INPUTS,", "\"", ")", ";", "break", ";", "case", "1", ":", "writer", ".", "write", "(", "\"one", "input", "(\"", ")", ";", "break", ";", "case", "2", ":", "writer", ".", "write", "(", "\"two", "inputs", "(\"", ")", ";", "break", ";", "case", "3", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "4", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "5", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "6", ":", "writer", ".", "write", "(", "\"six", "inputs", "(\"", ")", ";", "break", ";", "case", "7", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "8", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "9", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "default", ":", "writer", ".", "write", "(", "numInputs", "+", "\"", "inputs", "(\"", ")", ";", "}", "if", "(", "numInputs", ">", "0", ")", "{", "Iterator", "<", "Signal", ">", "sigIt", "=", "this", ".", "getInputIterator", "(", ")", ";", "while", "(", "sigIt", ".", "hasNext", "(", ")", ")", "{", "Signal", "sig", "=", "sigIt", ".", "next", "(", ")", ";", "if", "(", "sig", "!=", "null", ")", "{", "String", "theName", "=", "sig", ".", "getName", "(", ")", ";", "if", "(", "theName", "==", "null", ")", "writer", ".", "write", "(", "\"\"", ")", ";", "else", "writer", ".", "write", "(", "theName", ")", ";", "}", "if", "(", "sigIt", ".", "hasNext", "(", ")", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "}", "writer", ".", "write", "(", "\"),", "\"", ")", ";", "}", "switch", "(", "numOutputs", ")", "{", "case", "0", ":", "writer", ".", "write", "(", "\"NO", "OUTPUTS,", "\"", ")", ";", "break", ";", "case", "1", ":", "writer", ".", "write", "(", "\"one", "output", "(\"", ")", ";", "break", ";", "case", "2", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "3", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "4", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "5", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "6", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "7", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "8", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "case", "9", ":", "writer", ".", "write", "(", "\"\"", ")", ";", "break", ";", "default", ":", "writer", ".", "write", "(", "numOutputs", "+", "\"", "(\"", ")", ";", "}", "if", "(", "numOutputs", ">", "0", ")", "{", "Signal", "sig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "sig", "!=", "null", ")", "{", "String", "theName", "=", "sig", ".", "getName", "(", ")", ";", "if", "(", "theName", "==", "null", ")", "writer", ".", "write", "(", "\"\"", ")", ";", "else", "writer", ".", "write", "(", "theName", ")", ";", "}", "writer", ".", "write", "(", "\"),", "\"", ")", ";", "}", "writer", ".", "write", "(", "\"value", "[\"", "+", "this", ".", "value", "+", "\"]\"", ")", ";", "}", "abstract", "public", "void", "update", "(", ")", "throws", "DAVEException", ";", "}", "</s>" ]
8,447
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "public", "class", "BlockLimiter", "extends", "Block", "{", "String", "units", ";", "Double", "lowerLim", ";", "Double", "upperLim", ";", "boolean", "hasLowerLim", ";", "boolean", "hasUpperLim", ";", "public", "BlockLimiter", "(", "Signal", "sourceSignal", ",", "Model", "m", ",", "double", "lowerLimit", ",", "double", "upperLimit", ")", "{", "super", "(", "sourceSignal", ".", "getName", "(", ")", "+", "\"", "limiter\"", ",", "\"limiter\"", ",", "1", ",", "m", ")", ";", "this", ".", "units", "=", "sourceSignal", ".", "getUnits", "(", ")", ";", "lowerLim", "=", "lowerLimit", ";", "upperLim", "=", "upperLimit", ";", "if", "(", "lowerLim", ">", "upperLim", ")", "{", "Double", "temp", "=", "lowerLim", ";", "lowerLim", "=", "upperLim", ";", "upperLim", "=", "temp", ";", "}", "hasLowerLim", "=", "!", "lowerLim", ".", "isInfinite", "(", ")", ";", "hasUpperLim", "=", "!", "upperLim", ".", "isInfinite", "(", ")", ";", "sourceSignal", ".", "addSink", "(", "this", ",", "1", ")", ";", "}", "@", "Override", "public", "double", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "this", ".", "units", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "String", "rel", ";", "Signal", "input", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "outputSig", "!=", "null", ")", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "input", "=", "inputs", ".", "get", "(", "0", ")", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "cvn", ".", "append", "(", "input", ".", "genCode", "(", ")", ")", ";", "if", "(", "this", ".", "hasLowerLimit", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "rel", "=", "\"", "<", "\"", ";", "if", "(", "dialect", "==", "Model", ".", "DT_FORTRAN", ")", "rel", "=", "\"", ".LT.", "\"", ";", "cvn", ".", "appendCode", "(", "beginIf", "(", "outVarID", "+", "rel", "+", "lowerLim", ".", "toString", "(", ")", ")", ")", ";", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "\"", "\"", "+", "outVarID", "+", "\"", "=", "\"", "+", "lowerLim", ".", "toString", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "endIf", "(", ")", ")", ";", "}", "if", "(", "this", ".", "hasUpperLimit", "(", ")", ")", "{", "if", "(", "!", "this", ".", "hasLowerLimit", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "rel", "=", "\"", ">", "\"", ";", "if", "(", "dialect", "==", "Model", ".", "DT_FORTRAN", ")", "rel", "=", "\"", ".GT.", "\"", ";", "cvn", ".", "appendCode", "(", "beginIf", "(", "outVarID", "+", "rel", "+", "upperLim", ".", "toString", "(", ")", ")", ")", ";", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "\"", "\"", "+", "outVarID", "+", "\"", "=", "\"", "+", "upperLim", ".", "toString", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "endIf", "(", ")", ")", ";", "}", "if", "(", "outputSig", "!=", "null", ")", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "if", "(", "!", "this", ".", "hasLowerLimit", "(", ")", "&&", "!", "this", ".", "hasUpperLimit", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"", "(\"", "+", "units", "+", "\"\"", "+", "\"\"", "+", "lowerLim", "+", "\"\"", "+", "upperLim", "+", "\".\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "Signal", "theInput", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "double", "inputValue", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", ")", ";", "this", ".", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "this", ".", "value", "=", "inputValue", ";", "if", "(", "hasLowerLim", ")", "if", "(", "this", ".", "value", "<", "lowerLim", ")", "this", ".", "value", "=", "lowerLim", ";", "if", "(", "hasUpperLim", ")", "if", "(", "this", ".", "value", ">", "upperLim", ")", "this", ".", "value", "=", "upperLim", ";", "}", "public", "boolean", "hasLowerLimit", "(", ")", "{", "return", "hasLowerLim", ";", "}", "public", "boolean", "hasUpperLimit", "(", ")", "{", "return", "hasUpperLim", ";", "}", "public", "double", "getLowerLimit", "(", ")", "{", "return", "lowerLim", ".", "doubleValue", "(", ")", ";", "}", "public", "double", "getUpperLimit", "(", ")", "{", "return", "upperLim", ".", "doubleValue", "(", ")", ";", "}", "}", "</s>" ]
8,448
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "com", ".", "sun", ".", "org", ".", "apache", ".", "xerces", ".", "internal", ".", "util", ".", "XMLCatalogResolver", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "org", ".", "jdom", ".", "Document", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "JDOMException", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "import", "org", ".", "jdom", ".", "input", ".", "SAXBuilder", ";", "public", "class", "DAVE", "{", "String", "myVersion", ";", "Model", "m", ";", "Namespace", "ns", ";", "int", "argNum", ";", "String", "base_uri", ";", "String", "args", "[", "]", ";", "String", "inputFileName", ";", "String", "listFileName", ";", "String", "stubName", ";", "boolean", "makeListing", ";", "boolean", "createInternalValues", ";", "boolean", "evaluate", ";", "boolean", "verboseFlag", ";", "boolean", "genStatsFlag", ";", "boolean", "noProcessingRequired", ";", "boolean", "helpRequested", ";", "int", "varDefCount", ";", "int", "bpDefCount", ";", "int", "gtDefCount", ";", "int", "functionCount", ";", "int", "checkCaseCount", ";", "InputStream", "_inputStream", ";", "long", "parseStartTime", ";", "long", "parseStopTime", ";", "Element", "root", ";", "CheckData", "checkcases", ";", "private", "static", "final", "int", "exit_success", "=", "0", ";", "private", "static", "final", "int", "exit_failure", "=", "1", ";", "public", "DAVE", "(", ")", "{", "this", ".", "makeListing", "=", "false", ";", "this", ".", "createInternalValues", "=", "false", ";", "this", ".", "evaluate", "=", "false", ";", "this", ".", "verboseFlag", "=", "false", ";", "this", ".", "genStatsFlag", "=", "false", ";", "this", ".", "noProcessingRequired", "=", "false", ";", "this", ".", "helpRequested", "=", "false", ";", "this", ".", "checkCaseCount", "=", "0", ";", "this", ".", "m", "=", "new", "Model", "(", "20", ",", "20", ")", ";", "String", "date", "=", "\"2012-07-19\"", ";", "this", ".", "myVersion", "=", "\"0.9.4", "(\"", "+", "date", "+", "\")\"", ";", "}", "public", "DAVE", "(", "String", "args", "[", "]", ")", "{", "this", "(", ")", ";", "this", ".", "parseOptions", "(", "args", ")", ";", "if", "(", "this", ".", "verboseFlag", ")", "{", "m", ".", "makeVerbose", "(", ")", ";", "}", "if", "(", "this", ".", "helpRequested", ")", "{", "this", ".", "printHelp", "(", ")", ";", "}", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "this", ".", "m", ".", "makeVerbose", "(", ")", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verboseFlag", "=", "false", ";", "this", ".", "m", ".", "silence", "(", ")", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verboseFlag", ";", "}", "public", "String", "getVersion", "(", ")", "{", "return", "this", ".", "myVersion", ";", "}", "public", "boolean", "hasCheckcases", "(", ")", "{", "return", "this", ".", "checkcases", "!=", "null", ";", "}", "public", "CheckData", "getCheckcaseData", "(", ")", "{", "return", "this", ".", "checkcases", ";", "}", "public", "void", "setInputFileName", "(", "String", "fn", ")", "{", "this", ".", "inputFileName", "=", "fn", ";", "this", ".", "stubName", "=", "DAVE", ".", "toStubName", "(", "fn", ")", ";", "}", "public", "String", "getInputFileName", "(", ")", "{", "return", "this", ".", "inputFileName", ";", "}", "public", "String", "getStubName", "(", ")", "{", "return", "this", ".", "stubName", ";", "}", "public", "Model", "getModel", "(", ")", "{", "return", "this", ".", "m", ";", "}", ";", "public", "void", "setGenStatsFlag", "(", ")", "{", "this", ".", "genStatsFlag", "=", "true", ";", "}", "public", "boolean", "getGenStatsFlag", "(", ")", "{", "return", "this", ".", "genStatsFlag", ";", "}", "public", "void", "setArgs", "(", "String", "args", "[", "]", ")", "{", "this", ".", "args", "=", "args", ";", "}", "public", "String", "[", "]", "getArgs", "(", ")", "{", "return", "this", ".", "args", ";", "}", "public", "int", "numCmdLineSwitches", "(", ")", "{", "int", "index", ";", "int", "count", "=", "0", ";", "for", "(", "index", "=", "0", ";", "index", "<", "this", ".", "args", ".", "length", ";", "index", "++", ")", "{", "if", "(", "this", ".", "args", "[", "index", "]", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "count", "++", ";", "}", "}", "return", "count", ";", "}", "public", "boolean", "verify", "(", ")", "{", "boolean", "result", "=", "true", ";", "int", "goodCases", "=", "0", ";", "if", "(", "checkcases", "==", "null", ")", "{", "return", "true", ";", "}", "ArrayList", "<", "StaticShot", ">", "shots", "=", "checkcases", ".", "getStaticShots", "(", ")", ";", "Iterator", "<", "StaticShot", ">", "shit", "=", "shots", ".", "iterator", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Verifying", "\"", "+", "shots", ".", "size", "(", ")", "+", "\"", "check-cases\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "shit", ".", "hasNext", "(", ")", ")", "{", "StaticShot", "shot", "=", "shit", ".", "next", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "shot", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "try", "{", "VectorInfoArrayList", "inputVec", "=", "m", ".", "getInputVector", "(", ")", ";", "shot", ".", "loadInputVector", "(", "inputVec", ")", ";", "m", ".", "cycle", "(", ")", ";", "VectorInfoArrayList", "outputVec", "=", "m", ".", "getOutputVector", "(", ")", ";", "if", "(", "outputVec", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "boolean", "matched", "=", "shot", ".", "checkOutputs", "(", "outputVec", ")", ";", "if", "(", "!", "matched", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "shot", ".", "getName", "(", ")", "+", "\"'.\"", ")", ";", "result", "=", "false", ";", "}", "else", "{", "goodCases", "++", ";", "if", "(", "this", ".", "createInternalValues", ")", "{", "String", "checkCaseName", "=", "this", ".", "stubName", "+", "\"_\"", "+", "toFileName", "(", "shot", ".", "getName", "(", ")", ")", "+", "\".txt\"", ";", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "checkCaseName", ")", ";", "PrintWriter", "pw", "=", "new", "PrintWriter", "(", "fos", ")", ";", "m", ".", "generateInternalValues", "(", "pw", ")", ";", "pw", ".", "flush", "(", ")", ";", "fos", ".", "close", "(", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"Verified", "\"", "+", "goodCases", "+", "\"", "of", "\"", "+", "shots", ".", "size", "(", ")", "+", "\"\"", ")", ";", "if", "(", "this", ".", "createInternalValues", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "return", "result", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "parseVariableDefs", "(", ")", "{", "Signal", "dummySig", ";", "List", "<", "Element", ">", "variableList", "=", "root", ".", "getChildren", "(", "\"variableDef\"", ",", "this", ".", "ns", ")", ";", "if", "(", "variableList", ".", "size", "(", ")", ">", "0", ")", "{", "Iterator", "<", "Element", ">", "variableIterator", "=", "variableList", ".", "iterator", "(", ")", ";", "this", ".", "varDefCount", "=", "variableList", ".", "size", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "varDefCount", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "variableIterator", ".", "hasNext", "(", ")", ")", "{", "dummySig", "=", "new", "Signal", "(", "variableIterator", ".", "next", "(", ")", ",", "m", ")", ";", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "parseTableDefs", "(", ")", "{", "FuncTable", "dummyFuncTable", ";", "List", "<", "Element", ">", "gtdList", "=", "root", ".", "getChildren", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "gtdList", ".", "size", "(", ")", ">", "0", ")", "{", "Iterator", "gtdi", "=", "gtdList", ".", "iterator", "(", ")", ";", "this", ".", "gtDefCount", "=", "gtdList", ".", "size", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "gtDefCount", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "gtdi", ".", "hasNext", "(", ")", ")", "{", "try", "{", "dummyFuncTable", "=", "new", "FuncTable", "(", "(", "Element", ")", "gtdi", ".", "next", "(", ")", ",", "m", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "parseBreakpointDefs", "(", ")", "{", "BreakpointSet", "ignored", ";", "List", "<", "Element", ">", "bpList", "=", "root", ".", "getChildren", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "bpList", ".", "size", "(", ")", ">", "0", ")", "{", "Iterator", "bpIt", "=", "bpList", ".", "iterator", "(", ")", ";", "this", ".", "bpDefCount", "=", "bpList", ".", "size", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "bpDefCount", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "bpIt", ".", "hasNext", "(", ")", ")", "{", "try", "{", "ignored", "=", "new", "BreakpointSet", "(", "(", "Element", ")", "bpIt", ".", "next", "(", ")", ",", "m", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "parseFunctions", "(", ")", "{", "BlockFuncTable", "ignored", ";", "List", "<", "Element", ">", "functionList", "=", "root", ".", "getChildren", "(", "\"function\"", ",", "this", ".", "ns", ")", ";", "if", "(", "functionList", ".", "size", "(", ")", ">", "0", ")", "{", "Iterator", "functionIterator", "=", "functionList", ".", "iterator", "(", ")", ";", "this", ".", "functionCount", "=", "functionList", ".", "size", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "functionCount", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "functionIterator", ".", "hasNext", "(", ")", ")", "{", "try", "{", "ignored", "=", "new", "BlockFuncTable", "(", "(", "Element", ")", "functionIterator", ".", "next", "(", ")", ",", "m", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "}", "}", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "parseCheckCases", "(", ")", "{", "Element", "checkData", "=", "root", ".", "getChild", "(", "\"checkData\"", ",", "this", ".", "ns", ")", ";", "if", "(", "checkData", "!=", "null", ")", "{", "this", ".", "checkcases", "=", "new", "CheckData", "(", "checkData", ".", "getChildren", "(", "\"staticShot\"", ",", "this", ".", "ns", ")", ")", ";", "this", ".", "checkCaseCount", "=", "this", ".", "checkcases", ".", "count", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Parsing", "\"", "+", "checkCaseCount", "+", "\"", "check-cases\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "}", "public", "boolean", "parseFile", "(", ")", "throws", "IOException", "{", "File", "f", "=", "new", "File", "(", "this", ".", "inputFileName", ")", ";", "String", "fullURI", "=", "f", ".", "toURI", "(", ")", ".", "toString", "(", ")", ";", "this", ".", "base_uri", "=", "fullURI", ";", "this", ".", "m", ".", "setName", "(", "this", ".", "stubName", ")", ";", "this", ".", "parseStartTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "Document", "doc", "=", "load", "(", ")", ";", "root", "=", "doc", ".", "getRootElement", "(", ")", ";", "this", ".", "ns", "=", "root", ".", "getNamespace", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "ns", ".", "getURI", "(", ")", "+", "\"\"", ")", ";", "}", "parseVariableDefs", "(", ")", ";", "parseBreakpointDefs", "(", ")", ";", "parseTableDefs", "(", ")", ";", "parseFunctions", "(", ")", ";", "m", ".", "wireBlocks", "(", ")", ";", "m", ".", "hookUpIO", "(", ")", ";", "parseCheckCases", "(", ")", ";", "this", ".", "parseStopTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "boolean", "result", "=", "m", ".", "verifyIntegrity", "(", ")", ";", "try", "{", "m", ".", "initialize", "(", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "DAVE", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "return", "result", ";", "}", "public", "Document", "load", "(", ")", "throws", "IOException", "{", "Document", "doc", "=", "null", ";", "XMLCatalogResolver", "cr", "=", "null", ";", "String", "directory_uri", "=", "this", ".", "base_uri", ".", "substring", "(", "0", ",", "this", ".", "base_uri", ".", "lastIndexOf", "(", "'/'", ")", ")", ";", "String", "errorLine", "=", "\"No", "error.\"", ";", "boolean", "tryValidationFlag", "=", "true", ";", "int", "numberOfFailures", "=", "0", ";", "boolean", "success", "=", "false", ";", "while", "(", "numberOfFailures", "<", "2", "&&", "!", "success", ")", "{", "success", "=", "true", ";", "errorLine", "=", "\"\"", ";", "try", "{", "_inputStream", "=", "new", "FileInputStream", "(", "this", ".", "inputFileName", ")", ";", "assert", "(", "_inputStream", "!=", "null", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "inputFileName", "+", "\"':", "\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "try", "{", "SAXBuilder", "builder", "=", "new", "SAXBuilder", "(", "tryValidationFlag", ")", ";", "builder", ".", "setFeature", "(", "\"\"", ",", "false", ")", ";", "if", "(", "tryValidationFlag", ")", "{", "String", "[", "]", "catalogs", ";", "String", "xml_catalog_files", "=", "System", ".", "getenv", "(", "\"\"", ")", ";", "if", "(", "xml_catalog_files", "==", "null", ")", "{", "xml_catalog_files", "=", "System", ".", "getProperty", "(", "\"\"", ")", ";", "}", "if", "(", "xml_catalog_files", "!=", "null", ")", "{", "catalogs", "=", "new", "String", "[", "]", "{", "xml_catalog_files", ",", "\"catalog.xml\"", ",", "\"catalog\"", ",", "\"\"", "}", ";", "}", "else", "{", "catalogs", "=", "new", "String", "[", "]", "{", "\"catalog.xml\"", ",", "\"catalog\"", ",", "\"\"", "}", ";", "}", "cr", "=", "new", "XMLCatalogResolver", "(", "catalogs", ")", ";", "}", "else", "{", "cr", "=", "null", ";", "}", "builder", ".", "setEntityResolver", "(", "cr", ")", ";", "doc", "=", "builder", ".", "build", "(", "_inputStream", ",", "directory_uri", ")", ";", "}", "catch", "(", "java", ".", "io", ".", "FileNotFoundException", "e", ")", "{", "errorLine", "=", "errorLine", "+", "e", ".", "getMessage", "(", ")", ";", "numberOfFailures", "++", ";", "success", "=", "false", ";", "}", "catch", "(", "java", ".", "net", ".", "UnknownHostException", "e", ")", "{", "errorLine", "=", "errorLine", "+", "\"\"", ";", "numberOfFailures", "++", ";", "success", "=", "false", ";", "}", "catch", "(", "java", ".", "net", ".", "ConnectException", "e", ")", "{", "errorLine", "=", "errorLine", "+", "\"\"", ";", "numberOfFailures", "++", ";", "success", "=", "false", ";", "}", "catch", "(", "java", ".", "io", ".", "IOException", "e", ")", "{", "errorLine", "=", "errorLine", "+", "\"\"", ";", "numberOfFailures", "++", ";", "success", "=", "false", ";", "}", "catch", "(", "JDOMException", "e", ")", "{", "errorLine", "=", "errorLine", "+", "\"n\"", "+", "e", ".", "getMessage", "(", ")", ";", "numberOfFailures", "++", ";", "success", "=", "false", ";", "}", "if", "(", "numberOfFailures", "==", "1", "&&", "!", "success", ")", "{", "System", ".", "err", ".", "println", "(", "errorLine", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "tryValidationFlag", "=", "false", ";", "_inputStream", ".", "close", "(", ")", ";", "}", "}", "if", "(", "!", "success", "&&", "numberOfFailures", ">=", "2", ")", "{", "_inputStream", ".", "close", "(", ")", ";", "System", ".", "err", ".", "println", "(", "errorLine", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "if", "(", "success", ")", "{", "System", ".", "out", ".", "println", "(", "\"Loaded", "'\"", "+", "this", ".", "inputFileName", "+", "\"\"", ")", ";", "org", ".", "jdom", ".", "DocType", "dt", "=", "doc", ".", "getDocType", "(", ")", ";", "switch", "(", "numberOfFailures", ")", "{", "case", "0", ":", "System", ".", "out", ".", "print", "(", "\"\"", ")", ";", "String", "catalogURI", "=", "cr", ".", "resolvePublic", "(", "dt", ".", "getPublicID", "(", ")", ",", "dt", ".", "getSystemID", "(", ")", ")", ";", "if", "(", "catalogURI", "==", "null", ")", "{", "System", ".", "out", ".", "print", "(", "dt", ".", "getSystemID", "(", ")", ")", ";", "}", "else", "{", "System", ".", "out", ".", "print", "(", "catalogURI", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\".'\"", ")", ";", "break", ";", "case", "1", ":", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "return", "doc", ";", "}", "public", "void", "describeSelf", "(", ")", "{", "try", "{", "TreeFileWriter", "writer", "=", "new", "TreeFileWriter", "(", "this", ".", "listFileName", ")", ";", "writer", ".", "describe", "(", "m", ")", ";", "writer", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", ";", "}", "}", "public", "void", "reportStats", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "varDefCount", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "bpDefCount", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "gtDefCount", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "functionCount", ")", ";", "if", "(", "this", ".", "checkCaseCount", ">", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "checkCaseCount", ")", ";", "}", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "(", "this", ".", "parseStopTime", "-", "this", ".", "parseStartTime", ")", "/", "1000.0", "+", "\"", "seconds.\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "m", ".", "reportStats", "(", ")", ";", "}", "static", "String", "toStubName", "(", "String", "inString", ")", "{", "File", "F", "=", "new", "File", "(", "inString", ")", ";", "String", "name", "=", "F", ".", "getName", "(", ")", ";", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "name", ")", ";", "String", "stubName", ";", "stubName", "=", "null", ";", "int", "dotIndex", "=", "buf", ".", "length", "(", ")", ";", "while", "(", "dotIndex", ">", "0", ")", "{", "dotIndex", "--", ";", "if", "(", "buf", ".", "charAt", "(", "dotIndex", ")", "==", "'.'", ")", "{", "break", ";", "}", "}", "if", "(", "dotIndex", ">", "0", ")", "{", "stubName", "=", "buf", ".", "substring", "(", "0", ",", "dotIndex", ")", ";", "}", "return", "stubName", ";", "}", "static", "String", "toFileName", "(", "String", "inString", ")", "{", "int", "limit", "=", "32", ";", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "inString", ")", ";", "StringWriter", "fileName", "=", "new", "StringWriter", "(", "limit", ")", ";", "for", "(", "int", "i", "=", "0", ";", "(", "i", "<", "buf", ".", "length", "(", ")", ")", "&&", "(", "fileName", ".", "getBuffer", "(", ")", ".", "length", "(", ")", "<", "limit", ")", ";", "i", "++", ")", "{", "char", "c", "=", "buf", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'.'", ":", "case", "','", ":", "case", "';'", ":", "case", "':'", ":", "case", "'\\''", ":", "case", "'\"'", ":", "case", "'('", ":", "case", "')'", ":", "case", "'['", ":", "case", "']'", ":", "case", "'{'", ":", "case", "'}'", ":", "break", ";", "case", "'", "'", ":", "case", "'\\t'", ":", "fileName", ".", "write", "(", "'_'", ")", ";", "break", ";", "default", ":", "fileName", ".", "write", "(", "c", ")", ";", "}", "}", "return", "fileName", ".", "toString", "(", ")", ";", "}", "public", "int", "loadInputs", "(", "VectorInfoArrayList", "inVec", ")", "throws", "IOException", "{", "int", "tokenType", ";", "FileReader", "frin", "=", "new", "FileReader", "(", "FileDescriptor", ".", "in", ")", ";", "StreamTokenizer", "st", "=", "new", "StreamTokenizer", "(", "frin", ")", ";", "st", ".", "parseNumbers", "(", ")", ";", "st", ".", "eolIsSignificant", "(", "true", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "Iterator", "<", "VectorInfo", ">", "in", "=", "inVec", ".", "iterator", "(", ")", ";", "while", "(", "in", ".", "hasNext", "(", ")", ")", "{", "boolean", "blankLine", "=", "false", ";", "VectorInfo", "inVal", "=", "in", ".", "next", "(", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "\"", "+", "inVal", ".", "getName", "(", ")", "+", "\"", "(\"", "+", "inVal", ".", "getUnits", "(", ")", "+", "\")", "[\"", "+", "inVal", ".", "getValue", "(", ")", "+", "\"]", ":", "\"", ")", ";", "do", "{", "tokenType", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "tokenType", "==", "StreamTokenizer", ".", "TT_EOF", ")", "{", "return", "-", "1", ";", "}", "if", "(", "tokenType", "==", "StreamTokenizer", ".", "TT_EOL", ")", "{", "blankLine", "=", "true", ";", "break", ";", "}", "}", "while", "(", "tokenType", "!=", "StreamTokenizer", ".", "TT_NUMBER", ")", ";", "if", "(", "!", "blankLine", ")", "{", "try", "{", "inVal", ".", "setValue", "(", "st", ".", "nval", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "}", "do", "{", "tokenType", "=", "st", ".", "nextToken", "(", ")", ";", "if", "(", "tokenType", "==", "StreamTokenizer", ".", "TT_EOF", ")", "{", "return", "-", "1", ";", "}", "}", "while", "(", "tokenType", "!=", "StreamTokenizer", ".", "TT_EOL", ")", ";", "}", "}", "return", "0", ";", "}", "public", "void", "listOutputs", "(", "VectorInfoArrayList", "outVec", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "Iterator", "<", "VectorInfo", ">", "it", "=", "outVec", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "vi", "=", "it", ".", "next", "(", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "\"", "+", "vi", ".", "getName", "(", ")", "+", "\"", "=", "\"", "+", "vi", ".", "getValue", "(", ")", ")", ";", "if", "(", "vi", ".", "getUnits", "(", ")", ".", "length", "(", ")", ">", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"", "(\"", "+", "vi", ".", "getUnits", "(", ")", "+", "\")\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}", "protected", "boolean", "matchOptionArgs", "(", "String", "uniqueOptionStart", ",", "String", "fullOptionString", ")", "{", "boolean", "matched", "=", "false", ";", "int", "index", ";", "for", "(", "index", "=", "0", ";", "index", "<", "this", ".", "args", ".", "length", ";", "index", "++", ")", "{", "if", "(", "this", ".", "args", "[", "index", "]", ".", "startsWith", "(", "\"--\"", ")", ")", "{", "if", "(", "this", ".", "args", "[", "index", "]", ".", "startsWith", "(", "\"--\"", "+", "fullOptionString", ")", ")", "{", "matched", "=", "true", ";", "this", ".", "argNum", "=", "index", ";", "}", "}", "if", "(", "this", ".", "args", "[", "index", "]", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "if", "(", "this", ".", "args", "[", "index", "]", ".", "startsWith", "(", "\"-\"", "+", "uniqueOptionStart", ")", ")", "{", "matched", "=", "true", ";", "this", ".", "argNum", "=", "index", ";", "}", "}", "}", "return", "matched", ";", "}", "private", "void", "printHelp", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "private", "void", "parseOptions", "(", "String", "inArgs", "[", "]", ")", "{", "String", "exampleUse", "=", "\"\"", ";", "int", "numArgs", "=", "inArgs", ".", "length", ";", "if", "(", "numArgs", "<", "1", ")", "{", "System", ".", "out", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "setArgs", "(", "inArgs", ")", ";", "this", ".", "inputFileName", "=", "this", ".", "args", "[", "numArgs", "-", "1", "]", ";", "if", "(", "this", ".", "inputFileName", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "numArgs", "++", ";", "}", "else", "{", "this", ".", "stubName", "=", "DAVE", ".", "toStubName", "(", "this", ".", "inputFileName", ")", ";", "this", ".", "listFileName", "=", "this", ".", "stubName", "+", "\".txt\"", ";", "}", "if", "(", "numArgs", ">", "1", ")", "{", "int", "parsedArgs", "=", "0", ";", "if", "(", "matchOptionArgs", "(", "\"c\"", ",", "\"count\"", ")", ")", "{", "this", ".", "genStatsFlag", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"d\"", ",", "\"debug\"", ")", ")", "{", "this", ".", "verboseFlag", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"e\"", ",", "\"eval\"", ")", ")", "{", "this", ".", "evaluate", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"i\"", ",", "\"internal\"", ")", ")", "{", "this", ".", "createInternalValues", "=", "true", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"l\"", ",", "\"list\"", ")", ")", "{", "this", ".", "makeListing", "=", "true", ";", "if", "(", "numArgs", ">", "(", "this", ".", "argNum", "+", "2", ")", ")", "{", "if", "(", "!", "this", ".", "args", "[", "this", ".", "argNum", "+", "1", "]", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "this", ".", "listFileName", "=", "this", ".", "args", "[", "this", ".", "argNum", "+", "1", "]", ";", "}", "}", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"v\"", ",", "\"version\"", ")", ")", "{", "this", ".", "noProcessingRequired", "=", "true", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "getVersion", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "matchOptionArgs", "(", "\"h\"", ",", "\"help\"", ")", ")", "{", "this", ".", "noProcessingRequired", "=", "true", ";", "this", ".", "helpRequested", "=", "true", ";", "parsedArgs", "++", ";", "}", "int", "numSwitches", "=", "this", ".", "numCmdLineSwitches", "(", ")", ";", "if", "(", "parsedArgs", "<", "numSwitches", ")", "{", "System", ".", "err", ".", "print", "(", "\"\"", ")", ";", "if", "(", "numSwitches", "==", "1", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "args", "[", "this", ".", "argNum", "]", "+", "\"'.\"", ")", ";", "}", "else", "if", "(", "numSwitches", "==", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "numSwitches", "+", "\"\"", ")", ";", "}", "System", ".", "err", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "boolean", "success", "=", "false", ";", "DAVE", "dave", "=", "new", "DAVE", "(", "args", ")", ";", "if", "(", "dave", ".", "noProcessingRequired", ")", "{", "System", ".", "exit", "(", "exit_success", ")", ";", "}", "try", "{", "success", "=", "dave", ".", "parseFile", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "!", "success", ")", "{", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "if", "(", "dave", ".", "checkcases", "!=", "null", ")", "{", "if", "(", "!", "dave", ".", "verify", "(", ")", ")", "{", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "}", "if", "(", "dave", ".", "genStatsFlag", ")", "{", "dave", ".", "reportStats", "(", ")", ";", "}", "if", "(", "dave", ".", "makeListing", ")", "{", "dave", ".", "describeSelf", "(", ")", ";", "}", "if", "(", "dave", ".", "evaluate", ")", "{", "while", "(", "true", ")", "{", "try", "{", "VectorInfoArrayList", "inputVec", "=", "dave", ".", "m", ".", "getInputVector", "(", ")", ";", "int", "eof", "=", "dave", ".", "loadInputs", "(", "inputVec", ")", ";", "if", "(", "eof", "==", "-", "1", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "exit", "(", "exit_success", ")", ";", "}", "dave", ".", "m", ".", "cycle", "(", ")", ";", "VectorInfoArrayList", "outputVec", "=", "dave", ".", "m", ".", "getOutputVector", "(", ")", ";", "if", "(", "outputVec", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "dave", ".", "listOutputs", "(", "outputVec", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", "}", "</s>" ]
8,449
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "</s>" ]
8,450
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "HashMap", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "ListIterator", ";", "import", "java", ".", "util", ".", "Map", ";", "import", "java", ".", "util", ".", "Set", ";", "import", "java", ".", "io", ".", "PrintWriter", ";", "import", "java", ".", "io", ".", "StringWriter", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "public", "class", "Model", "{", "protected", "String", "ourName", ";", "SignalArrayList", "signals", ";", "BlockArrayList", "blocks", ";", "Map", "<", "String", ",", "BreakpointSet", ">", "breakpointSets", ";", "Map", "<", "String", ",", "FuncTable", ">", "tables", ";", "Map", "<", "String", ",", "BlockBP", ">", "bpBlocks", ";", "BlockArrayList", "executeOrder", ";", "BlockArrayList", "inputBlocks", ";", "BlockArrayList", "outputBlocks", ";", "VectorInfoArrayList", "inputVec", ";", "VectorInfoArrayList", "outputVec", ";", "String", "dataFormat", ";", "boolean", "initialized", ";", "boolean", "verbose", ";", "int", "cycleCounter", ";", "int", "codeDialect", ";", "public", "static", "final", "int", "DT_FORTRAN", "=", "0", ";", "public", "static", "final", "int", "DT_ANSI_C", "=", "1", ";", "private", "static", "final", "int", "exit_success", "=", "0", ";", "private", "static", "final", "int", "exit_failure", "=", "1", ";", "private", "static", "String", "defaultDataFormat", "=", "\"0.000000E00\"", ";", "public", "Model", "(", "int", "numBlocks", ",", "int", "numSignals", ")", "{", "this", ".", "signals", "=", "new", "SignalArrayList", "(", "numSignals", ")", ";", "this", ".", "blocks", "=", "new", "BlockArrayList", "(", "numBlocks", ")", ";", "this", ".", "breakpointSets", "=", "new", "HashMap", "<", "String", ",", "BreakpointSet", ">", "(", ")", ";", "this", ".", "tables", "=", "new", "HashMap", "<", "String", ",", "FuncTable", ">", "(", ")", ";", "this", ".", "bpBlocks", "=", "new", "HashMap", "<", "String", ",", "BlockBP", ">", "(", ")", ";", "this", ".", "executeOrder", "=", "new", "BlockArrayList", "(", "numBlocks", ")", ";", "this", ".", "inputBlocks", "=", "new", "BlockArrayList", "(", "numBlocks", ")", ";", "this", ".", "outputBlocks", "=", "new", "BlockArrayList", "(", "numBlocks", ")", ";", "this", ".", "initialized", "=", "false", ";", "this", ".", "verbose", "=", "false", ";", "this", ".", "cycleCounter", "=", "0", ";", "this", ".", "ourName", "=", "\"untitled\"", ";", "this", ".", "codeDialect", "=", "DT_ANSI_C", ";", "this", ".", "dataFormat", "=", "defaultDataFormat", ";", "}", "public", "Model", "(", ")", "{", "this", "(", "20", ",", "20", ")", ";", "}", "public", "void", "setName", "(", "String", "theName", ")", "{", "this", ".", "ourName", "=", "theName", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "ourName", ";", "}", "public", "int", "getCycleCounter", "(", ")", "{", "return", "this", ".", "cycleCounter", ";", "}", "public", "void", "resetCycleCounter", "(", ")", "{", "this", ".", "cycleCounter", "=", "0", ";", "}", "public", "void", "incrementCycleCounter", "(", ")", "{", "this", ".", "cycleCounter", "++", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verbose", "=", "true", ";", "if", "(", "signals", "!=", "null", ")", "{", "Iterator", "<", "?", ">", "it", "=", "signals", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "(", "Signal", ")", "it", ".", "next", "(", ")", ";", "s", ".", "makeVerbose", "(", ")", ";", "}", "}", "if", "(", "blocks", "!=", "null", ")", "{", "Iterator", "<", "?", ">", "it", "=", "blocks", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "(", "Block", ")", "it", ".", "next", "(", ")", ";", "b", ".", "makeVerbose", "(", ")", ";", "}", "}", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verbose", "=", "false", ";", "if", "(", "signals", "!=", "null", ")", "{", "Iterator", "<", "?", ">", "it", "=", "signals", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "(", "Signal", ")", "it", ".", "next", "(", ")", ";", "s", ".", "silence", "(", ")", ";", "}", "}", "if", "(", "blocks", "!=", "null", ")", "{", "Iterator", "<", "?", ">", "it", "=", "blocks", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "(", "Block", ")", "it", ".", "next", "(", ")", ";", "b", ".", "silence", "(", ")", ";", "}", "}", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verbose", ";", "}", "public", "void", "clearSelections", "(", ")", "{", "Iterator", "<", "Block", ">", "blkIt", "=", "this", ".", "blocks", ".", "iterator", "(", ")", ";", "while", "(", "blkIt", ".", "hasNext", "(", ")", ")", "{", "Block", "blk", "=", "blkIt", ".", "next", "(", ")", ";", "blk", ".", "deselect", "(", ")", ";", "}", "}", "public", "boolean", "selectOutputByName", "(", "String", "varName", ")", "{", "boolean", "found", "=", "false", ";", "Iterator", "<", "Block", ">", "blkIt", "=", "this", ".", "outputBlocks", ".", "iterator", "(", ")", ";", "while", "(", "blkIt", ".", "hasNext", "(", ")", ")", "{", "Block", "blk", "=", "blkIt", ".", "next", "(", ")", ";", "if", "(", "blk", ".", "numInputs", "(", ")", ">", "0", ")", "{", "Signal", "inputSig", "=", "blk", ".", "getInput", "(", "0", ")", ";", "if", "(", "inputSig", ".", "myName", ".", "equals", "(", "varName", ")", ")", "{", "found", "=", "true", ";", "blk", ".", "selectWithAncestors", "(", ")", ";", "break", ";", "}", "}", "}", "return", "found", ";", "}", "public", "SignalArrayList", "getSignals", "(", ")", "{", "return", "signals", ";", "}", "public", "BlockArrayList", "getBlocks", "(", ")", "{", "return", "blocks", ";", "}", "public", "int", "getNumInputBlocks", "(", ")", "{", "return", "inputBlocks", ".", "size", "(", ")", ";", "}", "public", "BlockArrayList", "getInputBlocks", "(", ")", "{", "return", "inputBlocks", ";", "}", "public", "int", "getNumOutputBlocks", "(", ")", "{", "return", "outputBlocks", ".", "size", "(", ")", ";", "}", "public", "BlockArrayList", "getOutputBlocks", "(", ")", "{", "return", "outputBlocks", ";", "}", "public", "int", "getCodeDialect", "(", ")", "{", "return", "codeDialect", ";", "}", "public", "void", "setCodeDialect", "(", "int", "dialect", ")", "{", "codeDialect", "=", "dialect", ";", "}", "public", "void", "add", "(", "Block", "newBlock", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"Adding", "\"", "+", "newBlock", ".", "getType", "(", ")", "+", "\"", "block", "'\"", "+", "newBlock", ".", "getName", "(", ")", "+", "\"'", "to", "model.\"", ")", ";", "newBlock", ".", "makeVerbose", "(", ")", ";", "}", "blocks", ".", "add", "(", "newBlock", ")", ";", "if", "(", "newBlock", "instanceof", "BlockInput", ")", "{", "inputBlocks", ".", "add", "(", "newBlock", ")", ";", "if", "(", "this", ".", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputBlocks", ".", "size", "(", ")", ")", ";", "}", "if", "(", "newBlock", "instanceof", "BlockOutput", ")", "outputBlocks", ".", "add", "(", "newBlock", ")", ";", "}", "public", "void", "add", "(", "Signal", "newSignal", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "newSignal", ".", "getName", "(", ")", "+", "\"'", "to", "model.\"", ")", ";", "newSignal", ".", "makeVerbose", "(", ")", ";", "}", "signals", ".", "add", "(", "newSignal", ")", ";", "}", "public", "void", "register", "(", "BreakpointSet", "newBPSet", ")", "{", "int", "oldSize", "=", "0", ";", "int", "setSize", "=", "0", ";", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "newBPSet", ".", "getName", "(", ")", "+", "\"", "(\"", "+", "newBPSet", ".", "getBPID", "(", ")", "+", "\"\"", ")", ";", "oldSize", "=", "breakpointSets", ".", "size", "(", ")", ";", "}", "breakpointSets", ".", "put", "(", "newBPSet", ".", "getBPID", "(", ")", ",", "newBPSet", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "String", "key", "=", "newBPSet", ".", "getBPID", "(", ")", ";", "boolean", "success", "=", "breakpointSets", ".", "containsKey", "(", "key", ")", ";", "setSize", "=", "breakpointSets", ".", "size", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "setSize", ")", ";", "if", "(", "success", "&&", "(", "setSize", ">", "oldSize", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "key", "+", "\"'\"", ")", ";", "else", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "BreakpointSet", "getBPSetByID", "(", "String", "bpID", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "bpID", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "breakpointSets", ".", "containsKey", "(", "bpID", ")", ")", "{", "return", "breakpointSets", ".", "get", "(", "bpID", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "bpID", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "return", "null", ";", "}", "public", "void", "register", "(", "BlockBP", "newBPBlock", ")", "{", "int", "oldSize", "=", "0", ";", "int", "setSize", "=", "0", ";", "String", "key", "=", "newBPBlock", ".", "getName", "(", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "key", "+", "\"", "with", "model.\"", ")", ";", "oldSize", "=", "bpBlocks", ".", "size", "(", ")", ";", "}", "bpBlocks", ".", "put", "(", "key", ",", "newBPBlock", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "boolean", "success", "=", "bpBlocks", ".", "containsKey", "(", "key", ")", ";", "setSize", "=", "bpBlocks", ".", "size", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "setSize", ")", ";", "if", "(", "success", "&&", "(", "setSize", ">", "oldSize", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "key", "+", "\"'\"", ")", ";", "else", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "BlockBP", "getBPBlockByID", "(", "String", "bpID", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "bpID", "+", "\"'\"", ")", ";", "}", "if", "(", "bpBlocks", ".", "containsKey", "(", "bpID", ")", ")", "{", "return", "bpBlocks", ".", "get", "(", "bpID", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "bpID", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "return", "null", ";", "}", "public", "void", "register", "(", "FuncTable", "newTable", ")", "{", "int", "oldSize", "=", "0", ";", "int", "setSize", "=", "0", ";", "String", "key", "=", "newTable", ".", "getGTID", "(", ")", ";", "if", "(", "key", "==", "null", ")", "{", "key", "=", "newTable", ".", "getName", "(", ")", "+", "\"_fakeID\"", ";", "}", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "newTable", ".", "getName", "(", ")", "+", "\"", "(\"", "+", "key", "+", "\")", "to", "model.\"", ")", ";", "oldSize", "=", "tables", ".", "size", "(", ")", ";", "}", "tables", ".", "put", "(", "key", ",", "newTable", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "boolean", "success", "=", "tables", ".", "containsKey", "(", "key", ")", ";", "setSize", "=", "tables", ".", "size", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "setSize", ")", ";", "if", "(", "success", "&&", "(", "setSize", ">", "oldSize", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "key", "+", "\"'\"", ")", ";", "else", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "FuncTable", "getTableByID", "(", "String", "gtID", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "gtID", "+", "\"'\"", ")", ";", "}", "if", "(", "tables", ".", "containsKey", "(", "gtID", ")", ")", "{", "return", "tables", ".", "get", "(", "gtID", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "gtID", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "return", "null", ";", "}", "public", "int", "getNumBlocks", "(", ")", "{", "return", "blocks", ".", "size", "(", ")", ";", "}", "public", "int", "getNumSignals", "(", ")", "{", "return", "signals", ".", "size", "(", ")", ";", "}", "public", "int", "getNumTables", "(", ")", "{", "return", "tables", ".", "size", "(", ")", ";", "}", "public", "void", "wireBlocks", "(", ")", "{", "Iterator", "<", "Block", ">", "it", "=", "blocks", ".", "iterator", "(", ")", ";", "int", "numBlocks", "=", "blocks", ".", "size", "(", ")", ";", "if", "(", "numBlocks", ">", "0", "&&", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Wiring", "\"", "+", "numBlocks", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "it", ".", "next", "(", ")", ";", "try", "{", "b", ".", "hookUp", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"Block", "'\"", "+", "b", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "}", "public", "void", "hookUpIO", "(", ")", "{", "Signal", "theSignal", ";", "Iterator", "<", "Signal", ">", "it", ";", "ArrayList", "<", "Signal", ">", "modifiedSignals", "=", "new", "ArrayList", "<", "Signal", ">", "(", "0", ")", ";", "it", "=", "this", ".", "signals", ".", "iterator", "(", ")", ";", "Block", "ignored", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "theSignal", "=", "it", ".", "next", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theSignal", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "if", "(", "!", "theSignal", ".", "hasSource", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "if", "(", "theSignal", ".", "hasIC", "(", ")", "&&", "!", "(", "theSignal", ".", "isInput", "(", ")", "||", "theSignal", ".", "isControl", "(", ")", "||", "theSignal", ".", "isDisturbance", "(", ")", ")", ")", "{", "Block", "b", "=", "new", "BlockMathConstant", "(", "theSignal", ".", "getIC", "(", ")", ",", "this", ")", ";", "try", "{", "b", ".", "addOutput", "(", "theSignal", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "else", "{", "ignored", "=", "new", "BlockInput", "(", "theSignal", ",", "this", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "if", "(", "theSignal", ".", "isLimited", "(", ")", ")", "setUpLimiterFor", "(", "theSignal", ",", "modifiedSignals", ")", ";", "if", "(", "!", "theSignal", ".", "hasDest", "(", ")", "||", "theSignal", ".", "isOutput", "(", ")", ")", "ignored", "=", "new", "BlockOutput", "(", "theSignal", ",", "this", ")", ";", "}", "it", "=", "modifiedSignals", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "this", ".", "add", "(", "it", ".", "next", "(", ")", ")", ";", "}", "}", "public", "void", "setUpLimiterFor", "(", "Signal", "theSignal", ",", "ArrayList", "<", "Signal", ">", "modifiedSignals", ")", "{", "Block", "ignored", ";", "Signal", "limitedSignal", "=", "new", "Signal", "(", "theSignal", ")", ";", "boolean", "OK", "=", "modifiedSignals", ".", "add", "(", "limitedSignal", ")", ";", "assert", "(", "OK", ")", ";", "limitedSignal", ".", "setDerivedFlag", "(", ")", ";", "BlockArrayList", "origDests", "=", "(", "BlockArrayList", ")", "theSignal", ".", "getDests", "(", ")", ".", "clone", "(", ")", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "ArrayList", "<", "Integer", ">", "origPorts", "=", "(", "ArrayList", "<", "Integer", ">", ")", "theSignal", ".", "getDestPortNumbers", "(", ")", ".", "clone", "(", ")", ";", "String", "origName", "=", "theSignal", ".", "getName", "(", ")", ";", "String", "origVarID", "=", "theSignal", ".", "getVarID", "(", ")", ";", "theSignal", ".", "setName", "(", "theSignal", ".", "getName", "(", ")", "+", "\"_unlim\"", ")", ";", "theSignal", ".", "setVarID", "(", "theSignal", ".", "getVarID", "(", ")", "+", "\"_unlim\"", ")", ";", "theSignal", ".", "removeDestBlocks", "(", ")", ";", "theSignal", ".", "getSource", "(", ")", ".", "renameOutVarID", "(", ")", ";", "BlockLimiter", "limiter", "=", "new", "BlockLimiter", "(", "theSignal", ",", "this", ",", "theSignal", ".", "getLowerLimit", "(", ")", ",", "theSignal", ".", "getUpperLimit", "(", ")", ")", ";", "Iterator", "<", "Block", ">", "it", "=", "origDests", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "it", ".", "next", "(", ")", ";", "b", ".", "replaceInput", "(", "theSignal", ",", "limitedSignal", ")", ";", "}", "try", "{", "limiter", ".", "addOutput", "(", "limitedSignal", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "origName", ")", ";", "theSignal", ".", "dests", "=", "origDests", ";", "theSignal", ".", "destPorts", "=", "origPorts", ";", "theSignal", ".", "setName", "(", "origName", ")", ";", "theSignal", ".", "setVarID", "(", "origVarID", ")", ";", "}", "theSignal", ".", "clearIsOutputFlag", "(", ")", ";", "theSignal", ".", "setLowerLimit", "(", "Double", ".", "NEGATIVE_INFINITY", ")", ";", "theSignal", ".", "setUpperLimit", "(", "Double", ".", "POSITIVE_INFINITY", ")", ";", "if", "(", "!", "limitedSignal", ".", "hasDest", "(", ")", "||", "limitedSignal", ".", "isOutput", "(", ")", ")", "ignored", "=", "new", "BlockOutput", "(", "limitedSignal", ",", "this", ")", ";", "return", ";", "}", "public", "boolean", "verifyIntegrity", "(", ")", "{", "boolean", "missing", ";", "boolean", "OK", ";", "OK", "=", "true", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "Iterator", "<", "Block", ">", "blockIterator", "=", "this", ".", "getBlocks", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "blockIterator", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "blockIterator", ".", "next", "(", ")", ";", "missing", "=", "b", ".", "verifyInputs", "(", ")", ";", "if", "(", "missing", ")", "{", "System", ".", "err", ".", "println", "(", "\"", "Block", "\"", "+", "b", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "OK", "=", "false", ";", "}", "missing", "=", "b", ".", "verifyOutputs", "(", ")", ";", "if", "(", "missing", ")", "{", "System", ".", "err", ".", "println", "(", "\"", "Block", "\"", "+", "b", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "OK", "=", "false", ";", "}", "}", "Iterator", "<", "Signal", ">", "signalIterator", "=", "this", ".", "getSignals", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "signalIterator", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "signalIterator", ".", "next", "(", ")", ";", "missing", "=", "!", "s", ".", "hasSource", "(", ")", ";", "if", "(", "missing", ")", "{", "System", ".", "err", ".", "println", "(", "\"", "Signal", "\"", "+", "s", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "OK", "=", "false", ";", "}", "missing", "=", "!", "s", ".", "hasDest", "(", ")", ";", "if", "(", "missing", ")", "{", "System", ".", "err", ".", "println", "(", "\"", "Signal", "\"", "+", "s", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "OK", "=", "false", ";", "}", "}", "return", "OK", ";", "}", "public", "void", "generateInternalValues", "(", "PrintWriter", "out", ")", "{", "Iterator", "<", "?", ">", "it", "=", "this", ".", "signals", ".", "iterator", "(", ")", ";", "if", "(", "it", "!=", "null", ")", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "out", ".", "println", "(", "\"\"", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "(", "Signal", ")", "it", ".", "next", "(", ")", ";", "if", "(", "!", "s", ".", "isDerived", "(", ")", ")", "{", "out", ".", "print", "(", "\"\"", ")", ";", "out", ".", "print", "(", "s", ".", "getVarID", "(", ")", ")", ";", "out", ".", "print", "(", "\"\"", ")", ";", "try", "{", "out", ".", "print", "(", "s", ".", "sourceValue", "(", ")", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "out", ".", "print", "(", "\"\"", ")", ";", "out", ".", "println", "(", ")", ";", "}", "}", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "public", "void", "initialize", "(", ")", "throws", "DAVEException", "{", "if", "(", "!", "this", ".", "initialized", ")", "{", "StringWriter", "strwriter", "=", "null", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "strwriter", "=", "new", "StringWriter", "(", ")", ";", "if", "(", "strwriter", "==", "null", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "BlockArrayList", "blks", "=", "(", "BlockArrayList", ")", "blocks", ".", "clone", "(", ")", ";", "ListIterator", "<", "Block", ">", "candidates", ";", "Iterator", "<", "Block", ">", "blockIterator", ";", "Block", "b", ";", "boolean", "progress", "=", "true", ";", "int", "blocksNotReady", ";", "int", "oldBlocksNotReady", "=", "Integer", ".", "MAX_VALUE", ";", "while", "(", "!", "blks", ".", "isEmpty", "(", ")", "&&", "progress", ")", "{", "blocksNotReady", "=", "0", ";", "blockIterator", "=", "blks", ".", "iterator", "(", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Telling", "\"", "+", "blks", ".", "size", "(", ")", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "while", "(", "blockIterator", ".", "hasNext", "(", ")", ")", "{", "b", "=", "blockIterator", ".", "next", "(", ")", ";", "if", "(", "!", "b", ".", "isReady", "(", ")", ")", "try", "{", "blocksNotReady", "++", ";", "b", ".", "update", "(", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "out", ".", "print", "(", "\"", "Block", "'\"", "+", "b", ".", "getName", "(", ")", "+", "\"':\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "System", ".", "out", ".", "print", "(", "\"", "Block", "'\"", "+", "b", ".", "getName", "(", ")", "+", "\"':\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "e", ".", "getMessage", "(", ")", "+", "\"\"", ")", ";", "throw", "e", ";", "}", "}", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "candidates", "=", "blks", ".", "listIterator", "(", ")", ";", "while", "(", "candidates", ".", "hasNext", "(", ")", ")", "{", "b", "=", "candidates", ".", "next", "(", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", "+", "b", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "if", "(", "b", ".", "isReady", "(", ")", ")", "{", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "executeOrder", ".", "add", "(", "b", ")", ";", "candidates", ".", "remove", "(", ")", ";", "}", "else", "{", "if", "(", "this", ".", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "no.\"", ")", ";", "}", "}", "progress", "=", "blocksNotReady", "<", "oldBlocksNotReady", ";", "oldBlocksNotReady", "=", "blocksNotReady", ";", "}", "String", "errorMsg", "=", "\"\"", ";", "if", "(", "!", "blks", ".", "isEmpty", "(", ")", ")", "{", "errorMsg", "=", "\"\"", ";", "errorMsg", "=", "errorMsg", "+", "blks", ".", "size", "(", ")", "+", "\"", "blocks.\"", ";", "throw", "new", "DAVEException", "(", "errorMsg", ")", ";", "}", "this", ".", "initialized", "=", "true", ";", "if", "(", "this", ".", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Model", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "try", "{", "int", "i", "=", "1", ";", "blockIterator", "=", "executeOrder", ".", "iterator", "(", ")", ";", "while", "(", "blockIterator", ".", "hasNext", "(", ")", ")", "{", "b", "=", "blockIterator", ".", "next", "(", ")", ";", "if", "(", "this", ".", "verbose", ")", "{", "strwriter", ".", "write", "(", "i", "+", "\"", "\"", ")", ";", "b", ".", "describeSelf", "(", "strwriter", ")", ";", "strwriter", ".", "write", "(", "\"n\"", ")", ";", "}", "i", "++", ";", "}", "if", "(", "this", ".", "verbose", ")", "System", ".", "out", ".", "print", "(", "strwriter", ".", "toString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "}", "public", "VectorInfoArrayList", "getOutputVector", "(", ")", "throws", "DAVEException", "{", "if", "(", "this", ".", "outputVec", "==", "null", ")", "{", "this", ".", "outputVec", "=", "new", "VectorInfoArrayList", "(", ")", ";", "Iterator", "<", "?", ">", "outBlks", "=", "this", ".", "outputBlocks", ".", "iterator", "(", ")", ";", "while", "(", "outBlks", ".", "hasNext", "(", ")", ")", "{", "Block", "theBlk", "=", "(", "Block", ")", "outBlks", ".", "next", "(", ")", ";", "if", "(", "theBlk", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "if", "(", "!", "(", "theBlk", "instanceof", "BlockOutput", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "String", "theName", "=", "theBlk", ".", "getName", "(", ")", ";", "String", "theUnits", "=", "(", "(", "BlockOutput", ")", "theBlk", ")", ".", "getUnits", "(", ")", ";", "double", "theValue", "=", "theBlk", ".", "getValue", "(", ")", ";", "VectorInfo", "vi", "=", "new", "VectorInfo", "(", "theName", ",", "theUnits", ",", "theBlk", ",", "false", ")", ";", "vi", ".", "setValue", "(", "theValue", ")", ";", "this", ".", "outputVec", ".", "add", "(", "vi", ")", ";", "}", "}", "return", "this", ".", "outputVec", ";", "}", "public", "VectorInfoArrayList", "getInputVector", "(", ")", "throws", "DAVEException", "{", "if", "(", "this", ".", "inputVec", "==", "null", ")", "{", "this", ".", "inputVec", "=", "new", "VectorInfoArrayList", "(", ")", ";", "Iterator", "<", "?", ">", "inBlks", "=", "this", ".", "inputBlocks", ".", "iterator", "(", ")", ";", "while", "(", "inBlks", ".", "hasNext", "(", ")", ")", "{", "Block", "theBlk", "=", "(", "Block", ")", "inBlks", ".", "next", "(", ")", ";", "if", "(", "theBlk", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "if", "(", "!", "(", "theBlk", "instanceof", "BlockInput", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "String", "inName", "=", "theBlk", ".", "getName", "(", ")", ";", "String", "inUnits", "=", "(", "(", "BlockInput", ")", "theBlk", ")", ".", "getUnits", "(", ")", ";", "VectorInfo", "vi", "=", "new", "VectorInfo", "(", "inName", ",", "inUnits", ",", "theBlk", ",", "true", ")", ";", "this", ".", "inputVec", ".", "add", "(", "vi", ")", ";", "}", "}", "return", "this", ".", "inputVec", ";", "}", "public", "void", "cycle", "(", ")", "throws", "DAVEException", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "if", "(", "this", ".", "inputVec", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "if", "(", "this", ".", "inputVec", ".", "size", "(", ")", "!=", "inputBlocks", ".", "size", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "inputVec", ".", "size", "(", ")", "+", "\"\"", "+", "inputBlocks", ".", "size", "(", ")", ")", ";", "Iterator", "<", "VectorInfo", ">", "inp", "=", "this", ".", "inputVec", ".", "iterator", "(", ")", ";", "while", "(", "inp", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "vi", "=", "inp", ".", "next", "(", ")", ";", "if", "(", "vi", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "BlockInput", "theBlk", "=", "vi", ".", "getSink", "(", ")", ";", "double", "theValue", "=", "vi", ".", "getValue", "(", ")", ";", "theBlk", ".", "setInputValue", "(", "theValue", ")", ";", "}", "if", "(", "!", "this", ".", "initialized", ")", "try", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "this", ".", "initialize", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "exit", "(", "exit_failure", ")", ";", "}", "else", "{", "Iterator", "<", "?", ">", "theBlocks", "=", "executeOrder", ".", "iterator", "(", ")", ";", "while", "(", "theBlocks", ".", "hasNext", "(", ")", ")", "{", "Block", "theBlock", "=", "(", "Block", ")", "theBlocks", ".", "next", "(", ")", ";", "theBlock", ".", "update", "(", ")", ";", "}", "}", "if", "(", "this", ".", "outputVec", "==", "null", ")", "{", "this", ".", "outputVec", "=", "new", "VectorInfoArrayList", "(", ")", ";", "if", "(", "this", ".", "outputVec", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "Iterator", "<", "?", ">", "outBlks", "=", "this", ".", "outputBlocks", ".", "iterator", "(", ")", ";", "while", "(", "outBlks", ".", "hasNext", "(", ")", ")", "{", "Block", "theBlk", "=", "(", "Block", ")", "outBlks", ".", "next", "(", ")", ";", "if", "(", "theBlk", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "if", "(", "!", "(", "theBlk", "instanceof", "BlockOutput", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "String", "theName", "=", "theBlk", ".", "getName", "(", ")", ";", "String", "theUnits", "=", "(", "(", "BlockOutput", ")", "theBlk", ")", ".", "getUnits", "(", ")", ";", "double", "theValue", "=", "theBlk", ".", "getValue", "(", ")", ";", "VectorInfo", "vi", "=", "new", "VectorInfo", "(", "theName", ",", "theUnits", ",", "theBlk", ",", "false", ")", ";", "if", "(", "vi", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "vi", ".", "setValue", "(", "theValue", ")", ";", "this", ".", "outputVec", ".", "add", "(", "vi", ")", ";", "}", "}", "else", "{", "if", "(", "this", ".", "outputBlocks", ".", "size", "(", ")", "!=", "this", ".", "outputVec", ".", "size", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "Iterator", "<", "?", ">", "outBlks", "=", "this", ".", "outputBlocks", ".", "iterator", "(", ")", ";", "Iterator", "<", "?", ">", "outVI", "=", "this", ".", "outputVec", ".", "iterator", "(", ")", ";", "while", "(", "outBlks", ".", "hasNext", "(", ")", ")", "{", "BlockOutput", "theBlk", "=", "(", "BlockOutput", ")", "outBlks", ".", "next", "(", ")", ";", "VectorInfo", "vi", "=", "(", "VectorInfo", ")", "outVI", ".", "next", "(", ")", ";", "double", "theValue", "=", "theBlk", ".", "getValue", "(", ")", ";", "vi", ".", "setValue", "(", "theValue", ")", ";", "}", "}", "}", "public", "void", "reportStats", "(", ")", "{", "int", "total", "=", "0", ";", "if", "(", "!", "tables", ".", "isEmpty", "(", ")", ")", "{", "Set", "<", "String", ">", "tableKeySet", "=", "tables", ".", "keySet", "(", ")", ";", "Iterator", "<", "String", ">", "tableKeyIt", "=", "tableKeySet", ".", "iterator", "(", ")", ";", "while", "(", "tableKeyIt", ".", "hasNext", "(", ")", ")", "{", "String", "tableKey", "=", "tableKeyIt", ".", "next", "(", ")", ";", "FuncTable", "theTable", "=", "this", ".", "tables", ".", "get", "(", "tableKey", ")", ";", "total", "=", "total", "+", "theTable", ".", "size", "(", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "tables", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "breakpointSets", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "total", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "signals", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "blocks", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "inputBlocks", ".", "size", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "outputBlocks", ".", "size", "(", ")", ")", ";", "}", "public", "BlockArrayList", "getSortedBlocks", "(", ")", "throws", "DAVEException", "{", "if", "(", "executeOrder", "==", "null", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", ")", ";", "}", "return", "executeOrder", ";", "}", "public", "BlockArrayList", "getSelectedBlocks", "(", ")", "throws", "DAVEException", "{", "BlockArrayList", "sortedBlocks", "=", "getSortedBlocks", "(", ")", ";", "BlockArrayList", "selectedBlocks", "=", "new", "BlockArrayList", "(", ")", ";", "Iterator", "<", "Block", ">", "blkIt", "=", "sortedBlocks", ".", "iterator", "(", ")", ";", "while", "(", "blkIt", ".", "hasNext", "(", ")", ")", "{", "Block", "blk", "=", "blkIt", ".", "next", "(", ")", ";", "if", "(", "blk", ".", "isSelected", "(", ")", ")", "selectedBlocks", ".", "add", "(", "blk", ")", ";", "}", "return", "selectedBlocks", ";", "}", "public", "Block", "getBlockByOutputVarID", "(", "String", "theVarID", ")", "{", "Block", "theBlock", "=", "null", ";", "Signal", "theSignal", "=", "signals", ".", "findByID", "(", "theVarID", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "theBlock", "=", "theSignal", ".", "getSource", "(", ")", ";", "}", "return", "theBlock", ";", "}", "}", "</s>" ]
8,451
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathFunctionExtension", "extends", "BlockMathFunction", "{", "private", "static", "final", "int", "ATAN2", "=", "11", ";", "private", "static", "String", "DAVEML_EXT_URL", "=", "\"\"", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathFunctionExtension", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "m", ")", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "csymbol", "=", "ikid", ".", "next", "(", ")", ";", "if", "(", "csymbol", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "String", "csName", "=", "csymbol", ".", "getName", "(", ")", ";", "if", "(", "csName", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "!", "csName", ".", "equals", "(", "\"csymbol\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "csName", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "int", "csSize", "=", "csymbol", ".", "getContentSize", "(", ")", ";", "if", "(", "csSize", "!=", "1", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "csSize", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "String", "defURL", "=", "csymbol", ".", "getAttributeValue", "(", "\"\"", ")", ";", "if", "(", "defURL", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "if", "(", "!", "defURL", ".", "startsWith", "(", "DAVEML_EXT_URL", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "String", "encoding", "=", "csymbol", ".", "getAttributeValue", "(", "\"encoding\"", ")", ";", "if", "(", "encoding", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "if", "(", "!", "encoding", ".", "equals", "(", "\"text\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "funcType", "=", "csymbol", ".", "getTextTrim", "(", ")", ";", "if", "(", "this", ".", "funcType", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "setName", "(", "this", ".", "funcType", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "this", ".", "funcType", ".", "equals", "(", "\"atan2\"", ")", ")", "{", "if", "(", "defURL", "!=", "null", ")", "if", "(", "!", "defURL", ".", "equals", "(", "DAVEML_EXT_URL", "+", "\"#\"", "+", "this", ".", "funcType", ")", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "this", ".", "op", "=", "ATAN2", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "this", ".", "funcType", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "public", "void", "setFunction", "(", "String", "functionType", ")", "throws", "DAVEException", "{", "if", "(", "functionType", "!=", "this", ".", "funcType", ")", "super", ".", "setFunction", "(", "functionType", ")", ";", "}", "public", "void", "describeSelf", "(", "FileWriter", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "int", "requiredNumInputs", ";", "Iterator", "<", "Signal", ">", "theInputs", ";", "Signal", "theInput", ";", "double", "[", "]", "theInputValue", ";", "int", "index", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "myType", "+", "\"", "block", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"Math", "\"", "+", "this", ".", "myType", "+", "\"", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "requiredNumInputs", "=", "1", ";", "if", "(", "this", ".", "op", ">", "9", ")", "requiredNumInputs", "=", "2", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "requiredNumInputs", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "index", "=", "0", ";", "theInputValue", "=", "new", "double", "[", "2", "]", ";", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "theInputValue", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "theInputValue", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "Double", ".", "NaN", ";", "switch", "(", "this", ".", "op", ")", "{", "case", "ATAN2", ":", "this", ".", "value", "=", "Math", ".", "atan2", "(", "theInputValue", "[", "0", "]", ",", "theInputValue", "[", "1", "]", ")", ";", "break", ";", "}", "if", "(", "this", ".", "value", "==", "Double", ".", "NaN", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "funcType", "+", "\"", "in", "block", "\"", "+", "this", ".", "getName", "(", ")", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,452
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "VectorInfoArrayList", "extends", "ArrayList", "<", "VectorInfo", ">", "{", "public", "VectorInfoArrayList", "(", ")", "{", "super", "(", ")", ";", "}", "public", "VectorInfoArrayList", "(", "int", "initialCapacity", ")", "{", "super", "(", "initialCapacity", ")", ";", "}", "public", "VectorInfoArrayList", "(", "Collection", "<", "VectorInfo", ">", "c", ")", "{", "super", "(", "c", ")", ";", "}", "}", "</s>" ]
8,453
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "public", "class", "BlockMathConstant", "extends", "BlockMath", "{", "String", "stringValue", ";", "public", "BlockMathConstant", "(", "String", "constantValue", ",", "Model", "m", ")", "{", "super", "(", "\"const_\"", "+", "m", ".", "getNumBlocks", "(", ")", ",", "\"\"", ",", "m", ")", ";", "this", ".", "setValue", "(", "constantValue", ")", ";", "}", "public", "double", "getValueAsDouble", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "String", "getValueAsString", "(", ")", "{", "return", "this", ".", "stringValue", ";", "}", "public", "final", "void", "setValue", "(", "String", "newValue", ")", "{", "this", ".", "stringValue", "=", "newValue", ";", "try", "{", "this", ".", "value", "=", "Double", ".", "parseDouble", "(", "stringValue", ")", ";", "}", "catch", "(", "java", ".", "lang", ".", "NumberFormatException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "newValue", "+", "\"\"", "+", "\"\"", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "public", "void", "setValue", "(", "Double", "newValue", ")", "{", "this", ".", "value", "=", "newValue", ";", "this", ".", "stringValue", "=", "newValue", ".", "toString", "(", ")", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "cvn", ".", "appendCode", "(", "this", ".", "getValueAsString", "(", ")", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "0", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "@", "Override", "public", "boolean", "isReady", "(", ")", "{", "return", "true", ";", "}", "}", "</s>" ]
8,454
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathMinmax", "extends", "BlockMath", "{", "private", "static", "final", "int", "UNK", "=", "0", ";", "private", "static", "final", "int", "MIN", "=", "1", ";", "private", "static", "final", "int", "MAX", "=", "2", ";", "String", "funcType", ";", "int", "op", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathMinmax", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"maxmin\"", ",", "m", ")", ";", "this", ".", "funcType", "=", "null", ";", "this", ".", "op", "=", "UNK", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "try", "{", "this", ".", "setFunction", "(", "first", ".", "getName", "(", ")", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "first", ".", "getName", "(", ")", ")", ";", "}", "String", "blockType", "=", "first", ".", "getName", "(", ")", ";", "this", ".", "setName", "(", "blockType", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "blockType", ".", "equals", "(", "\"min\"", ")", "||", "blockType", ".", "equals", "(", "\"max\"", ")", "||", "blockType", ".", "equals", "(", "\"ceil\"", ")", "||", "blockType", ".", "equals", "(", "\"floor\"", ")", ")", "{", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "blockType", ")", ";", "}", "}", "private", "void", "setFunction", "(", "String", "functionType", ")", "throws", "DAVEException", "{", "this", ".", "funcType", "=", "functionType", ";", "this", ".", "setName", "(", "funcType", "+", "\"_\"", "+", "this", ".", "ourModel", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "funcType", ".", "equals", "(", "\"min\"", ")", ")", "{", "this", ".", "op", "=", "MIN", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"max\"", ")", ")", "{", "this", ".", "op", "=", "MAX", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "funcType", "+", "\"\"", ")", ";", "}", "public", "String", "getFuncType", "(", ")", "{", "return", "funcType", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "Iterator", "<", "Signal", ">", "theInputs", ";", "double", "[", "]", "inputVals", ";", "Signal", "theInput", ";", "int", "index", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "inputVals", "=", "new", "double", "[", "this", ".", "inputs", ".", "size", "(", ")", "]", ";", "index", "=", "0", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "inputVals", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "inputVals", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "0.0", ";", "switch", "(", "this", ".", "op", ")", "{", "case", "MIN", ":", "this", ".", "value", "=", "Double", ".", "POSITIVE_INFINITY", ";", "break", ";", "case", "MAX", ":", "this", ".", "value", "=", "Double", ".", "NEGATIVE_INFINITY", ";", "break", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputVals", ".", "length", ";", "i", "++", ")", "{", "switch", "(", "this", ".", "op", ")", "{", "case", "MIN", ":", "this", ".", "value", "=", "Math", ".", "min", "(", "this", ".", "value", ",", "inputVals", "[", "i", "]", ")", ";", "break", ";", "case", "MAX", ":", "this", ".", "value", "=", "Math", ".", "max", "(", "this", ".", "value", ",", "inputVals", "[", "i", "]", ")", ";", "break", ";", "}", "}", "if", "(", "this", ".", "value", "==", "Double", ".", "NaN", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "funcType", "+", "\"", "in", "block", "\"", "+", "this", ".", "getName", "(", ")", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,455
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathAbs", "extends", "BlockMath", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathAbs", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"\"", ",", "m", ")", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "this", ".", "setName", "(", "first", ".", "getName", "(", ")", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "!", "first", ".", "getName", "(", ")", ".", "equals", "(", "\"abs\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "}", "else", "{", "if", "(", "kids", ".", "size", "(", ")", ">", "2", ")", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "kids", ".", "size", "(", ")", "-", "1", ")", ")", ";", "else", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"Abs", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "1", ")", "throw", "new", "DAVEException", "(", "\"Abs", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "Signal", "theInput", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "double", "inputValue", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "this", ".", "value", "=", "Math", ".", "abs", "(", "inputValue", ")", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Signal", "input", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "input", "=", "inputs", ".", "get", "(", "0", ")", ";", "String", "op", "=", "\"fabs\"", ";", "if", "(", "ourModel", ".", "getCodeDialect", "(", ")", "==", "Model", ".", "DT_FORTRAN", ")", "op", "=", "\"ABS\"", ";", "cvn", ".", "appendCode", "(", "op", "+", "\"(", "\"", ")", ";", "cvn", ".", "append", "(", "input", ".", "genCode", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "\"", ")\"", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
8,456
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "abstract", "public", "class", "BlockMath", "extends", "Block", "{", "public", "BlockMath", "(", ")", "{", "super", "(", ")", ";", "}", "public", "BlockMath", "(", "Model", "m", ")", "{", "super", "(", "m", ")", ";", "}", "public", "BlockMath", "(", "String", "blockName", ",", "String", "blockType", ",", "Model", "m", ")", "{", "super", "(", "blockName", ",", "blockType", ",", "1", ",", "m", ")", ";", "}", "public", "BlockMath", "(", "String", "blockName", ",", "String", "blockType", ",", "int", "numInputs", ",", "Model", "m", ")", "{", "super", "(", "blockName", ",", "blockType", ",", "numInputs", ",", "m", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "BlockMath", "factory", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "String", "theType", "=", "first", ".", "getName", "(", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"abs\"", ")", ")", "return", "new", "BlockMathAbs", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"lt\"", ")", "||", "theType", ".", "equals", "(", "\"leq\"", ")", "||", "theType", ".", "equals", "(", "\"eq\"", ")", "||", "theType", ".", "equals", "(", "\"geq\"", ")", "||", "theType", ".", "equals", "(", "\"gt\"", ")", "||", "theType", ".", "equals", "(", "\"neq\"", ")", ")", "return", "new", "BlockMathRelation", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"minus\"", ")", ")", "return", "new", "BlockMathMinus", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"piecewise\"", ")", ")", "return", "new", "BlockMathSwitch", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"plus\"", ")", ")", "return", "new", "BlockMathSum", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"times\"", ")", "||", "theType", ".", "equals", "(", "\"quotient\"", ")", "||", "theType", ".", "equals", "(", "\"divide\"", ")", ")", "return", "new", "BlockMathProduct", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"max\"", ")", "||", "theType", ".", "equals", "(", "\"min\"", ")", ")", "return", "new", "BlockMathMinmax", "(", "applyElement", ",", "m", ")", ";", "if", "(", "theType", ".", "equals", "(", "\"power\"", ")", "||", "theType", ".", "equals", "(", "\"sin\"", ")", "||", "theType", ".", "equals", "(", "\"cos\"", ")", "||", "theType", ".", "equals", "(", "\"tan\"", ")", "||", "theType", ".", "equals", "(", "\"arcsin\"", ")", "||", "theType", ".", "equals", "(", "\"arccos\"", ")", "||", "theType", ".", "equals", "(", "\"arctan\"", ")", "||", "theType", ".", "equals", "(", "\"ceiling\"", ")", "||", "theType", ".", "equals", "(", "\"floor\"", ")", ")", "try", "{", "return", "new", "BlockMathFunction", "(", "applyElement", ",", "m", ")", ";", "}", "catch", "(", "DAVEException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "theType", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "-", "1", ")", ";", "}", "if", "(", "theType", ".", "equals", "(", "\"csymbol\"", ")", ")", "return", "new", "BlockMathFunctionExtension", "(", "applyElement", ",", "m", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "theType", "+", "\"\"", ")", ";", "return", "null", ";", "}", "public", "void", "genInputsFromApply", "(", "Iterator", "<", "Element", ">", "ikid", ",", "int", "inputPortNumber", ")", "{", "int", "i", "=", "inputPortNumber", ";", "while", "(", "ikid", ".", "hasNext", "(", ")", ")", "{", "Element", "in", "=", "ikid", ".", "next", "(", ")", ";", "String", "name", "=", "in", ".", "getName", "(", ")", ";", "if", "(", "name", ".", "equals", "(", "\"ci\"", ")", ")", "{", "String", "varID", "=", "in", ".", "getTextTrim", "(", ")", ";", "this", ".", "addVarID", "(", "i", ",", "varID", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "\"cn\"", ")", ")", "{", "String", "constantValue", "=", "in", ".", "getTextTrim", "(", ")", ";", "this", ".", "addConstInput", "(", "constantValue", ",", "i", ")", ";", "}", "else", "if", "(", "name", ".", "equals", "(", "\"apply\"", ")", ")", "{", "this", ".", "addVarID", "(", "i", ",", "\"\"", ")", ";", "Signal", "s", "=", "new", "Signal", "(", "in", ",", "ourModel", ")", ";", "if", "(", "s", "!=", "null", ")", "{", "s", ".", "addSink", "(", "this", ",", "i", ")", ";", "s", ".", "setDerivedFlag", "(", ")", ";", "}", "else", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "in", ".", "getName", "(", ")", ")", ";", "}", "i", "++", ";", "}", "}", "}", "</s>" ]
8,457
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathRelation", "extends", "BlockMath", "{", "private", "static", "final", "int", "UNK", "=", "0", ";", "private", "static", "final", "int", "LT", "=", "1", ";", "private", "static", "final", "int", "LEQ", "=", "2", ";", "private", "static", "final", "int", "EQ", "=", "3", ";", "private", "static", "final", "int", "GEQ", "=", "4", ";", "private", "static", "final", "int", "GT", "=", "5", ";", "private", "static", "final", "int", "NEQ", "=", "6", ";", "String", "relationOp", ";", "int", "relation", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathRelation", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"relation\"", ",", "m", ")", ";", "this", ".", "relation", "=", "UNK", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "this", ".", "relationOp", "=", "first", ".", "getName", "(", ")", ";", "this", ".", "setName", "(", "this", ".", "relationOp", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "!", "validateRelation", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "this", ".", "relationOp", ")", ";", "}", "else", "{", "if", "(", "kids", ".", "size", "(", ")", "!=", "3", ")", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "kids", ".", "size", "(", ")", "-", "1", ")", ")", ";", "else", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "}", "protected", "final", "boolean", "validateRelation", "(", ")", "{", "this", ".", "relation", "=", "UNK", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"lt\"", ")", ")", "this", ".", "relation", "=", "LT", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"leq\"", ")", ")", "this", ".", "relation", "=", "LEQ", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"eq\"", ")", ")", "this", ".", "relation", "=", "EQ", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"geq\"", ")", ")", "this", ".", "relation", "=", "GEQ", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"gt\"", ")", ")", "this", ".", "relation", "=", "GT", ";", "if", "(", "this", ".", "relationOp", ".", "equals", "(", "\"neq\"", ")", ")", "this", ".", "relation", "=", "NEQ", ";", "return", "(", "this", ".", "relation", "!=", "UNK", ")", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "if", "(", "inputs", "==", "null", ")", "{", "cvn", ".", "appendCode", "(", "errorComment", "(", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "if", "(", "inputs", ".", "size", "(", ")", "<", "2", ")", "{", "cvn", ".", "appendCode", "(", "errorComment", "(", "\"\"", "+", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "Signal", "arg1", "=", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "arg1", "==", "null", ")", "{", "cvn", ".", "appendCode", "(", "errorComment", "(", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "Signal", "arg2", "=", "inputs", ".", "get", "(", "1", ")", ";", "if", "(", "arg2", "==", "null", ")", "{", "cvn", ".", "appendCode", "(", "errorComment", "(", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "cvn", ".", "append", "(", "arg1", ".", "genCode", "(", ")", ")", ";", "int", "dialect", "=", "ourModel", ".", "getCodeDialect", "(", ")", ";", "switch", "(", "dialect", ")", "{", "case", "Model", ".", "DT_ANSI_C", ":", "switch", "(", "relation", ")", "{", "case", "LT", ":", "cvn", ".", "appendCode", "(", "\"", "<", "\"", ")", ";", "break", ";", "case", "LEQ", ":", "cvn", ".", "appendCode", "(", "\"", "<=", "\"", ")", ";", "break", ";", "case", "EQ", ":", "cvn", ".", "appendCode", "(", "\"", "==", "\"", ")", ";", "break", ";", "case", "GEQ", ":", "cvn", ".", "appendCode", "(", "\"", ">=", "\"", ")", ";", "break", ";", "case", "GT", ":", "cvn", ".", "appendCode", "(", "\"", ">", "\"", ")", ";", "break", ";", "case", "NEQ", ":", "cvn", ".", "appendCode", "(", "\"", "!=", "\"", ")", ";", "break", ";", "}", "break", ";", "case", "Model", ".", "DT_FORTRAN", ":", "switch", "(", "relation", ")", "{", "case", "LT", ":", "cvn", ".", "appendCode", "(", "\"", ".LT.", "\"", ")", ";", "break", ";", "case", "LEQ", ":", "cvn", ".", "appendCode", "(", "\"", ".LE.", "\"", ")", ";", "break", ";", "case", "EQ", ":", "cvn", ".", "appendCode", "(", "\"", ".EQ.", "\"", ")", ";", "break", ";", "case", "GEQ", ":", "cvn", ".", "appendCode", "(", "\"", ".GE.", "\"", ")", ";", "break", ";", "case", "GT", ":", "cvn", ".", "appendCode", "(", "\"", ".GT.", "\"", ")", ";", "break", ";", "case", "NEQ", ":", "cvn", ".", "appendCode", "(", "\"", ".NE.", "\"", ")", ";", "break", ";", "}", "break", ";", "}", "cvn", ".", "append", "(", "arg2", ".", "genCode", "(", ")", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "this", ".", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "public", "void", "setRelationOp", "(", "String", "relationString", ")", "throws", "DAVEException", "{", "this", ".", "relationOp", "=", "relationString", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "this", ".", "validateRelation", "(", ")", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "relationString", ")", ";", "}", "}", "public", "String", "getRelationOp", "(", ")", "{", "return", "this", ".", "relationOp", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "int", "numInputs", ";", "Iterator", "<", "Signal", ">", "theInputs", ";", "Signal", "theInput", ";", "double", "[", "]", "theInputValue", ";", "int", "index", "=", "0", ";", "int", "requiredInputs", "=", "2", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "numInputs", "=", "this", ".", "inputs", ".", "size", "(", ")", ";", "if", "(", "numInputs", "!=", "requiredInputs", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "requiredInputs", "+", "\".\"", ")", ";", "theInputValue", "=", "new", "double", "[", "requiredInputs", "]", ";", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "theInputValue", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "Double", ".", "NaN", ";", "switch", "(", "this", ".", "relation", ")", "{", "case", "LT", ":", "if", "(", "theInputValue", "[", "0", "]", "<", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "case", "LEQ", ":", "if", "(", "theInputValue", "[", "0", "]", "<=", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "case", "EQ", ":", "if", "(", "theInputValue", "[", "0", "]", "==", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "case", "GEQ", ":", "if", "(", "theInputValue", "[", "0", "]", ">=", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "case", "GT", ":", "if", "(", "theInputValue", "[", "0", "]", ">", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "case", "NEQ", ":", "if", "(", "theInputValue", "[", "0", "]", "!=", "theInputValue", "[", "1", "]", ")", "this", ".", "value", "=", "1.0", ";", "else", "this", ".", "value", "=", "0.0", ";", "break", ";", "}", "if", "(", "this", ".", "value", "==", "Double", ".", "NaN", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "relationOp", "+", "\"", "in", "block", "\"", "+", "this", ".", "getName", "(", ")", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,458
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "text", ".", "DecimalFormat", ";", "import", "java", ".", "text", ".", "NumberFormat", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "public", "class", "FuncTable", "{", "ArrayList", "<", "String", ">", "bpIDs", ";", "ArrayList", "<", "Double", ">", "functionValues", ";", "int", "[", "]", "myDimensions", ";", "String", "description", ";", "String", "tableName", ";", "String", "gtID", ";", "Model", "myModel", ";", "boolean", "verbose", ";", "BlockArrayList", "users", ";", "Namespace", "ns", ";", "public", "FuncTable", "(", "Model", "m", ")", "{", "this", ".", "bpIDs", "=", "new", "ArrayList", "<", "String", ">", "(", "5", ")", ";", "this", ".", "functionValues", "=", "null", ";", "this", ".", "myDimensions", "=", "null", ";", "this", ".", "description", "=", "\"\"", ";", "this", ".", "tableName", "=", "\"\"", ";", "this", ".", "gtID", "=", "\"\"", ";", "this", ".", "ns", "=", "null", ";", "this", ".", "myModel", "=", "m", ";", "this", ".", "verbose", "=", "false", ";", "this", ".", "users", "=", "new", "BlockArrayList", "(", "5", ")", ";", "}", "public", "FuncTable", "(", "String", "gtid", ",", "Element", "gtd", ",", "Model", "m", ")", "throws", "IOException", "{", "this", "(", "m", ")", ";", "if", "(", "gtd", ".", "getAttributeValue", "(", "\"name\"", ")", "!=", "null", ")", "this", ".", "tableName", "=", "gtd", ".", "getAttributeValue", "(", "\"name\"", ")", ";", "this", ".", "gtID", "=", "gtid", ";", "Element", "parent", "=", "gtd", ".", "getParentElement", "(", ")", ";", "if", "(", "parent", "!=", "null", ")", "this", ".", "ns", "=", "gtd", ".", "getParentElement", "(", ")", ".", "getNamespace", "(", ")", ";", "Element", "descrip", "=", "gtd", ".", "getChild", "(", "\"description\"", ",", "this", ".", "ns", ")", ";", "if", "(", "descrip", "!=", "null", ")", "this", ".", "description", "=", "descrip", ".", "getTextTrim", "(", ")", ";", "Element", "table", "=", "gtd", ".", "getChild", "(", "\"dataTable\"", ",", "this", ".", "ns", ")", ";", "this", ".", "functionValues", "=", "ParseText", ".", "toList", "(", "table", ".", "getTextTrim", "(", ")", ")", ";", "this", ".", "parseBPIDsFromTableDef", "(", "gtd", ")", ";", "m", ".", "register", "(", "this", ")", ";", "}", "public", "FuncTable", "(", "Element", "gtd", ",", "Model", "m", ")", "throws", "IOException", "{", "this", "(", "gtd", ".", "getAttributeValue", "(", "\"gtID\"", ")", ",", "gtd", ",", "m", ")", ";", "}", "public", "FuncTable", "(", "String", "tableID", ",", "String", "tableName", ",", "String", "tableValues", ",", "String", "description", ",", "int", "ndim", ",", "Model", "m", ")", "{", "this", "(", "m", ")", ";", "this", ".", "gtID", "=", "tableID", ";", "this", ".", "tableName", "=", "tableName", ";", "this", ".", "description", "=", "description", ";", "this", ".", "myDimensions", "=", "new", "int", "[", "ndim", "]", ";", "this", ".", "verbose", "=", "false", ";", "try", "{", "this", ".", "functionValues", "=", "ParseText", ".", "toList", "(", "tableValues", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "this", ".", "tableName", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "m", ".", "register", "(", "this", ")", ";", "}", "public", "void", "register", "(", "BlockFuncTable", "userBFT", ")", "{", "this", ".", "users", ".", "add", "(", "userBFT", ")", ";", "}", "public", "boolean", "isVerbose", "(", ")", "{", "return", "this", ".", "verbose", ";", "}", "public", "void", "makeVerbose", "(", ")", "{", "this", ".", "verbose", "=", "true", ";", "}", "public", "void", "silence", "(", ")", "{", "this", ".", "verbose", "=", "false", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "parseBPIDsFromTableDef", "(", "Element", "gtd", ")", "{", "Element", "breakpointRefs", "=", "gtd", ".", "getChild", "(", "\"\"", ",", "this", ".", "ns", ")", ";", "if", "(", "breakpointRefs", "==", "null", ")", "breakpointRefs", "=", "gtd", ".", "getChild", "(", "\"\"", ")", ";", "if", "(", "breakpointRefs", "!=", "null", ")", "{", "List", "<", "Element", ">", "bpRefs", "=", "breakpointRefs", ".", "getChildren", "(", "\"bpRef\"", ",", "this", ".", "ns", ")", ";", "if", "(", "bpRefs", "==", "null", ")", "bpRefs", "=", "breakpointRefs", ".", "getChildren", "(", "\"bpRef\"", ")", ";", "Iterator", "<", "Element", ">", "bpRefIterator", "=", "bpRefs", ".", "iterator", "(", ")", ";", "while", "(", "bpRefIterator", ".", "hasNext", "(", ")", ")", "{", "Element", "bpRefElement", "=", "bpRefIterator", ".", "next", "(", ")", ";", "String", "bpName", "=", "bpRefElement", ".", "getAttributeValue", "(", "\"bpID\"", ")", ";", "this", ".", "bpIDs", ".", "add", "(", "bpName", ")", ";", "}", "}", "this", ".", "setDimensions", "(", ")", ";", "}", "public", "void", "addBPID", "(", "int", "portNum", ",", "String", "bpID", ")", "{", "while", "(", "bpIDs", ".", "size", "(", ")", "<", "portNum", ")", "bpIDs", ".", "add", "(", "\"\"", ")", ";", "bpIDs", ".", "set", "(", "portNum", "-", "1", ",", "bpID", ")", ";", "}", "public", "Iterator", "<", "String", ">", "getBPIterator", "(", ")", "{", "return", "bpIDs", ".", "iterator", "(", ")", ";", "}", "public", "String", "getBPID", "(", "int", "portNum", ")", "{", "int", "portIndex", "=", "portNum", "-", "1", ";", "return", "bpIDs", ".", "get", "(", "portIndex", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "tableName", ";", "}", "public", "String", "getGTID", "(", ")", "{", "return", "this", ".", "gtID", ";", "}", "protected", "void", "setDimensions", "(", ")", "{", "this", ".", "myDimensions", "=", "new", "int", "[", "bpIDs", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "Iterator", "<", "String", ">", "bpit", "=", "this", ".", "bpIDs", ".", "iterator", "(", ")", ";", "while", "(", "bpit", ".", "hasNext", "(", ")", ")", "{", "String", "bpID", "=", "bpit", ".", "next", "(", ")", ";", "BreakpointSet", "bps", "=", "this", ".", "myModel", ".", "getBPSetByID", "(", "bpID", ")", ";", "if", "(", "bps", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "bpID", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "myDimensions", "[", "i", "]", "=", "bps", ".", "length", "(", ")", ";", "i", "++", ";", "}", "}", "public", "int", "size", "(", ")", "{", "if", "(", "this", ".", "functionValues", "==", "null", ")", "return", "0", ";", "return", "this", ".", "functionValues", ".", "size", "(", ")", ";", "}", "public", "int", "numDim", "(", ")", "{", "if", "(", "myDimensions", "==", "null", ")", "return", "0", ";", "return", "this", ".", "myDimensions", ".", "length", ";", "}", "public", "int", "dim", "(", "int", "theAxis", ")", "{", "return", "this", ".", "myDimensions", "[", "theAxis", "]", ";", "}", "public", "int", "[", "]", "getDimensions", "(", ")", "{", "return", "this", ".", "myDimensions", ";", "}", "public", "ArrayList", "<", "Double", ">", "getValues", "(", ")", "{", "return", "this", ".", "functionValues", ";", "}", "protected", "int", "printTable", "(", "Writer", "writer", ",", "ArrayList", "<", "Double", ">", "table", ",", "int", "[", "]", "dims", ",", "int", "startIndex", ")", "throws", "IOException", "{", "int", "offset", ";", "int", "i", ";", "String", "newline", "=", "System", ".", "getProperty", "(", "\"\"", ")", ";", "DecimalFormat", "form", "=", "new", "DecimalFormat", "(", "myModel", ".", "dataFormat", ")", ";", "switch", "(", "dims", ".", "length", ")", "{", "case", "0", ":", "return", "0", ";", "case", "1", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "Double", "theValue", "=", "table", ".", "get", "(", "i", "+", "startIndex", ")", ";", "String", "valueStr", "=", "form", ".", "format", "(", "theValue", ")", ";", "writer", ".", "write", "(", "valueStr", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "}", "return", "i", ";", "case", "2", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "1", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "offset", "=", "printTable", "(", "writer", ",", "table", ",", "newDims", ",", "startIndex", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "writer", ".", "write", "(", "newline", ")", ";", "startIndex", "=", "startIndex", "+", "offset", ";", "}", "return", "startIndex", ";", "default", ":", "for", "(", "i", "=", "0", ";", "i", "<", "dims", "[", "0", "]", ";", "i", "++", ")", "{", "int", "[", "]", "newDims", "=", "new", "int", "[", "1", "]", ";", "newDims", "[", "0", "]", "=", "dims", "[", "1", "]", ";", "offset", "=", "printTable", "(", "writer", ",", "table", ",", "newDims", ",", "startIndex", ")", ";", "if", "(", "i", "<", "dims", "[", "0", "]", "-", "1", ")", "writer", ".", "write", "(", "\",", "\"", ")", ";", "writer", ".", "write", "(", "newline", ")", ";", "startIndex", "=", "startIndex", "+", "offset", ";", "}", "return", "startIndex", ";", "}", "}", "public", "void", "printTable", "(", "Writer", "writer", ")", "throws", "IOException", "{", "printTable", "(", "writer", ",", "this", ".", "functionValues", ",", "this", ".", "myDimensions", ",", "0", ")", ";", "}", "public", "double", "getPt", "(", "int", "[", "]", "indices", ")", "{", "int", "mult", "=", "1", ";", "int", "offset", "=", "0", ";", "int", "i", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "print", "(", "\"\"", "+", "this", ".", "tableName", "+", "\"[\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "indices", ".", "length", ";", "i", "++", ")", "{", "System", ".", "out", ".", "print", "(", "\"", "\"", "+", "indices", "[", "i", "]", ")", ";", "if", "(", "i", "<", "indices", ".", "length", "-", "1", ")", "System", ".", "out", ".", "print", "(", "\",\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"", "]'\"", ")", ";", "}", "for", "(", "i", "=", "indices", ".", "length", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "getPt:", "i", "\"", "+", "i", ")", ";", "offset", "+=", "indices", "[", "i", "]", "*", "mult", ";", "mult", "*=", "this", ".", "myDimensions", "[", "i", "]", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "offset", "+", "\"", "mult", "\"", "+", "mult", ")", ";", "}", "Double", "value", "=", "functionValues", ".", "get", "(", "offset", ")", ";", "double", "val", "=", "value", ".", "doubleValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "val", ")", ";", "return", "val", ";", "}", "public", "String", "getDescription", "(", ")", "{", "return", "this", ".", "description", ";", "}", "}", "</s>" ]
8,459
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathSwitch", "extends", "BlockMath", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathSwitch", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"switch\"", ",", "m", ")", ";", "Namespace", "mathml", "=", "Namespace", ".", "getNamespace", "(", "\"\"", ",", "\"\"", ")", ";", "Element", "piecewise", "=", "applyElement", ".", "getChild", "(", "\"piecewise\"", ",", "mathml", ")", ";", "if", "(", "piecewise", "==", "null", ")", "{", "piecewise", "=", "applyElement", ".", "getChild", "(", "\"piecewise\"", ")", ";", "}", "if", "(", "piecewise", "==", "null", ")", "{", "List", "<", "Element", ">", "elist", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "elisti", "=", "elist", ".", "iterator", "(", ")", ";", "Element", "el", "=", "elisti", ".", "next", "(", ")", ";", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "el", ".", "getQualifiedName", "(", ")", "+", "\">.\"", ")", ";", "}", "else", "{", "this", ".", "setName", "(", "\"switch\"", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "List", "<", "Element", ">", "kids", "=", "piecewise", ".", "getChildren", "(", ")", ";", "if", "(", "kids", ".", "size", "(", ")", "<", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "kids", ".", "size", "(", ")", "+", "\"\"", ")", ";", "}", "else", "{", "List", "<", "Element", ">", "pieces", "=", "piecewise", ".", "getChildren", "(", "\"piece\"", ",", "mathml", ")", ";", "Element", "otherwise", "=", "piecewise", ".", "getChild", "(", "\"otherwise\"", ",", "mathml", ")", ";", "if", "(", "pieces", ".", "isEmpty", "(", ")", ")", "{", "pieces", "=", "piecewise", ".", "getChildren", "(", "\"piece\"", ")", ";", "}", "if", "(", "pieces", ".", "isEmpty", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "return", ";", "}", "if", "(", "otherwise", "==", "null", ")", "{", "otherwise", "=", "piecewise", ".", "getChild", "(", "\"otherwise\"", ")", ";", "}", "if", "(", "otherwise", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "return", ";", "}", "Element", "piece", "=", "pieces", ".", "get", "(", "0", ")", ";", "List", "<", "Element", ">", "pieceChildren", "=", "piece", ".", "getChildren", "(", ")", ";", "if", "(", "pieceChildren", ".", "size", "(", ")", "!=", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "pieces", ".", "size", "(", ")", "+", "\"", "instead.\"", ")", ";", "return", ";", "}", "List", "<", "Element", ">", "other", "=", "otherwise", ".", "getChildren", "(", ")", ";", "if", "(", "other", ".", "size", "(", ")", "!=", "1", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "other", ".", "size", "(", ")", "+", "\"", "instead.\"", ")", ";", "return", ";", "}", "this", ".", "genInputsFromApply", "(", "pieceChildren", ".", "iterator", "(", ")", ",", "1", ")", ";", "if", "(", "pieces", ".", "size", "(", ")", "<=", "1", ")", "{", "this", ".", "genInputsFromApply", "(", "other", ".", "iterator", "(", ")", ",", "3", ")", ";", "}", "else", "{", "boolean", "childRemoved", "=", "this", ".", "removeFirstPiece", "(", "piecewise", ")", ";", "if", "(", "!", "childRemoved", ")", "{", "throw", "new", "AssertionError", "(", "\"\"", "+", "\"\"", "+", "this", ".", "getName", "(", ")", ")", ";", "}", "BlockMathSwitch", "bms", "=", "new", "BlockMathSwitch", "(", "applyElement", ",", "m", ")", ";", "this", ".", "addInput", "(", "bms", ",", "3", ")", ";", "}", "}", "}", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Iterator", "<", "Signal", ">", "inputSig", "=", "inputs", ".", "iterator", "(", ")", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "inputs", "==", "null", ")", "{", "cvn", ".", "appendCode", "(", "this", ".", "errorComment", "(", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "if", "(", "inputs", ".", "size", "(", ")", "<", "3", ")", "{", "cvn", ".", "appendCode", "(", "this", ".", "errorComment", "(", "\"\"", "+", "\"\"", ")", ")", ";", "return", "cvn", ";", "}", "Signal", "defaultInput", "=", "inputs", ".", "get", "(", "2", ")", ";", "boolean", "defaultInputIsConst", "=", "defaultInput", ".", "source", ".", "getType", "(", ")", ".", "equals", "(", "\"\"", ")", ";", "if", "(", "defaultInput", ".", "isDerived", "(", ")", "&&", "defaultInputIsConst", ")", "{", "defaultInput", ".", "clearDerivedFlag", "(", ")", ";", "}", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "if", "(", "defaultInput", ".", "isDefined", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "defaultInput", ".", "getVarID", "(", ")", ")", ";", "}", "else", "{", "cvn", ".", "append", "(", "defaultInput", ".", "genCode", "(", ")", ")", ";", "}", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "CodeAndVarNames", "ifCvn", "=", "inputs", ".", "get", "(", "1", ")", ".", "genCode", "(", ")", ";", "cvn", ".", "addVarName", "(", "ifCvn", ".", "getVarName", "(", "0", ")", ")", ";", "cvn", ".", "appendCode", "(", "this", ".", "beginIf", "(", "ifCvn", ".", "getCode", "(", ")", ")", ")", ";", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "\"", "\"", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "append", "(", "inputs", ".", "get", "(", "0", ")", ".", "genCode", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "this", ".", "endLine", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "this", ".", "endIf", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "int", "numInputs", ";", "Iterator", "<", "Signal", ">", "theInputs", ";", "Signal", "theInput", ";", "double", "[", "]", "theInputValue", ";", "int", "index", "=", "0", ";", "int", "requiredInputs", "=", "3", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "numInputs", "=", "this", ".", "inputs", ".", "size", "(", ")", ";", "if", "(", "numInputs", "!=", "requiredInputs", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "requiredInputs", "+", "\".\"", ")", ";", "}", "theInputValue", "=", "new", "double", "[", "requiredInputs", "]", ";", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "}", "return", ";", "}", "else", "{", "theInputValue", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "theInputValue", "[", "2", "]", ";", "if", "(", "Math", ".", "abs", "(", "theInputValue", "[", "1", "]", ")", ">", "0.0001", ")", "{", "this", ".", "value", "=", "theInputValue", "[", "0", "]", ";", "}", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "private", "boolean", "removeFirstPiece", "(", "Element", "piecewise", ")", "{", "List", "kids", "=", "piecewise", ".", "getChildren", "(", ")", ";", "Iterator", "it", "=", "kids", ".", "iterator", "(", ")", ";", "boolean", "foundPiece", "=", "false", ";", "boolean", "removedPiece", "=", "false", ";", "while", "(", "(", "!", "foundPiece", ")", "&&", "(", "it", ".", "hasNext", "(", ")", ")", ")", "{", "Element", "el", "=", "(", "Element", ")", "it", ".", "next", "(", ")", ";", "foundPiece", "=", "(", "el", ".", "getName", "(", ")", "==", "null", "?", "\"piece\"", "==", "null", ":", "el", ".", "getName", "(", ")", ".", "equals", "(", "\"piece\"", ")", ")", ";", "}", "if", "(", "foundPiece", ")", "{", "it", ".", "remove", "(", ")", ";", "}", "return", "foundPiece", ";", "}", "}", "</s>" ]
8,460
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "public", "class", "BlockOutput", "extends", "Block", "{", "String", "units", ";", "public", "BlockOutput", "(", "Signal", "sourceSignal", ",", "Model", "m", ")", "{", "super", "(", "sourceSignal", ".", "getName", "(", ")", ",", "\"output\"", ",", "1", ",", "m", ")", ";", "this", ".", "units", "=", "sourceSignal", ".", "getUnits", "(", ")", ";", "sourceSignal", ".", "addSink", "(", "this", ",", "1", ")", ";", "}", "@", "Override", "public", "double", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "this", ".", "units", ";", "}", "public", "int", "getSeqNumber", "(", ")", "{", "BlockArrayList", "outputs", "=", "this", ".", "ourModel", ".", "getOutputBlocks", "(", ")", ";", "return", "outputs", ".", "indexOf", "(", "this", ")", "+", "1", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "cvn", ".", "appendCode", "(", "this", ".", "wrapComment", "(", "this", ".", "genComment", "(", ")", ")", ")", ";", "cvn", ".", "addVarName", "(", "this", ".", "getInput", "(", "0", ")", ".", "getVarID", "(", ")", ")", ";", "return", "cvn", ";", "}", "private", "String", "genComment", "(", ")", "{", "String", "code", "=", "\"\"", ";", "Signal", "theSignal", "=", "this", ".", "getInput", "(", "0", ")", ";", "String", "inVarID", "=", "theSignal", ".", "getVarID", "(", ")", ";", "if", "(", "theSignal", "!=", "null", ")", "{", "code", "=", "code", "+", "inVarID", ";", "if", "(", "theSignal", ".", "isStdAIAA", "(", ")", ")", "code", "=", "code", "+", "\"", "(\"", "+", "theSignal", ".", "getName", "(", ")", "+", "\")\"", ";", "code", "=", "code", "+", "\"\"", ";", "if", "(", "units", ".", "equalsIgnoreCase", "(", "\"nd\"", ")", ")", "code", "=", "code", "+", "\"\"", ";", "else", "code", "=", "code", "+", "\"\"", "+", "units", "+", "\"'\"", ";", "}", "return", "code", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"", "(\"", "+", "units", "+", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "Signal", "theInput", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "double", "inputValue", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", ")", ";", "this", ".", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "this", ".", "value", "=", "inputValue", ";", "}", "}", "</s>" ]
8,461
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathFunction", "extends", "BlockMath", "{", "private", "static", "final", "int", "UNK", "=", "0", ";", "private", "static", "final", "int", "SIN", "=", "1", ";", "private", "static", "final", "int", "COS", "=", "2", ";", "private", "static", "final", "int", "TAN", "=", "3", ";", "private", "static", "final", "int", "ARCSIN", "=", "4", ";", "private", "static", "final", "int", "ARCCOS", "=", "5", ";", "private", "static", "final", "int", "ARCTAN", "=", "6", ";", "private", "static", "final", "int", "FLOOR", "=", "7", ";", "private", "static", "final", "int", "CEIL", "=", "8", ";", "private", "static", "final", "int", "POW", "=", "10", ";", "String", "funcType", ";", "int", "op", ";", "public", "BlockMathFunction", "(", ")", "{", "super", "(", ")", ";", "this", ".", "funcType", "=", "null", ";", "this", ".", "op", "=", "UNK", ";", "}", "public", "BlockMathFunction", "(", "Model", "m", ")", "{", "super", "(", "m", ")", ";", "this", ".", "funcType", "=", "null", ";", "this", ".", "op", "=", "UNK", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathFunction", "(", "Element", "applyElement", ",", "Model", "m", ")", "throws", "DAVEException", "{", "super", "(", "\"pending\"", ",", "\"function\"", ",", "m", ")", ";", "this", ".", "op", "=", "UNK", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "this", ".", "setFunction", "(", "first", ".", "getName", "(", ")", ")", ";", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "protected", "void", "setFunction", "(", "String", "functionType", ")", "throws", "DAVEException", "{", "this", ".", "funcType", "=", "functionType", ";", "this", ".", "setName", "(", "funcType", "+", "\"_\"", "+", "this", ".", "ourModel", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "funcType", ".", "equals", "(", "\"power\"", ")", ")", "{", "this", ".", "op", "=", "POW", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"sin\"", ")", ")", "{", "this", ".", "op", "=", "SIN", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"cos\"", ")", ")", "{", "this", ".", "op", "=", "COS", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"tan\"", ")", ")", "{", "this", ".", "op", "=", "TAN", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"arcsin\"", ")", ")", "{", "this", ".", "op", "=", "ARCSIN", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"arccos\"", ")", ")", "{", "this", ".", "op", "=", "ARCCOS", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"arctan\"", ")", ")", "{", "this", ".", "op", "=", "ARCTAN", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"floor\"", ")", ")", "{", "this", ".", "op", "=", "FLOOR", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "if", "(", "funcType", ".", "equals", "(", "\"ceiling\"", ")", ")", "{", "this", ".", "op", "=", "CEIL", ";", "this", ".", "myType", "=", "\"\"", ";", "}", "else", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "funcType", "+", "\"\"", ")", ";", "}", "public", "String", "getFuncType", "(", ")", "{", "return", "funcType", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "int", "requiredNumInputs", ";", "Iterator", "<", "Signal", ">", "theInputs", ";", "Signal", "theInput", ";", "double", "[", "]", "theInputValue", ";", "int", "index", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "myType", "+", "\"", "block", "'\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"Math", "\"", "+", "this", ".", "myType", "+", "\"", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "requiredNumInputs", "=", "1", ";", "if", "(", "this", ".", "op", ">", "9", ")", "requiredNumInputs", "=", "2", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "requiredNumInputs", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "index", "=", "0", ";", "theInputValue", "=", "new", "double", "[", "2", "]", ";", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "theInputValue", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "theInputValue", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "Double", ".", "NaN", ";", "switch", "(", "this", ".", "op", ")", "{", "case", "POW", ":", "this", ".", "value", "=", "Math", ".", "pow", "(", "theInputValue", "[", "0", "]", ",", "theInputValue", "[", "1", "]", ")", ";", "break", ";", "case", "SIN", ":", "this", ".", "value", "=", "Math", ".", "sin", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "COS", ":", "this", ".", "value", "=", "Math", ".", "cos", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "TAN", ":", "this", ".", "value", "=", "Math", ".", "tan", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "ARCSIN", ":", "this", ".", "value", "=", "Math", ".", "asin", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "ARCCOS", ":", "this", ".", "value", "=", "Math", ".", "acos", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "ARCTAN", ":", "this", ".", "value", "=", "Math", ".", "atan", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "FLOOR", ":", "this", ".", "value", "=", "Math", ".", "floor", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "case", "CEIL", ":", "this", ".", "value", "=", "Math", ".", "ceil", "(", "theInputValue", "[", "0", "]", ")", ";", "break", ";", "}", "if", "(", "this", ".", "value", "==", "Double", ".", "NaN", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "funcType", "+", "\"", "in", "block", "\"", "+", "this", ".", "getName", "(", ")", ")", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,462
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "DAVEException", "extends", "Exception", "{", "public", "DAVEException", "(", ")", "{", "super", "(", ")", ";", "}", "public", "DAVEException", "(", "String", "s", ")", "{", "super", "(", "s", ")", ";", "}", "}", "</s>" ]
8,463
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "*", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "ParseText", "{", "protected", "StreamTokenizer", "st", ";", "protected", "boolean", "goodNumber", ";", "public", "ParseText", "(", "String", "inputData", ")", "{", "StringReader", "sr", "=", "new", "StringReader", "(", "inputData", ")", ";", "st", "=", "new", "StreamTokenizer", "(", "sr", ")", ";", "st", ".", "resetSyntax", "(", ")", ";", "st", ".", "whitespaceChars", "(", "0x09", ",", "0x2A", ")", ";", "st", ".", "whitespaceChars", "(", "0x2C", ",", "0x2C", ")", ";", "st", ".", "wordChars", "(", "0x2B", ",", "0x2B", ")", ";", "st", ".", "wordChars", "(", "0x2D", ",", "0x2e", ")", ";", "st", ".", "wordChars", "(", "0x30", ",", "0x39", ")", ";", "st", ".", "wordChars", "(", "0x45", ",", "0x45", ")", ";", "st", ".", "wordChars", "(", "0x65", ",", "0x65", ")", ";", "}", "public", "double", "next", "(", ")", "throws", "IOException", "{", "goodNumber", "=", "false", ";", "double", "value", "=", "Double", ".", "NaN", ";", "do", "{", "st", ".", "nextToken", "(", ")", ";", "switch", "(", "st", ".", "ttype", ")", "{", "case", "StreamTokenizer", ".", "TT_NUMBER", ":", "value", "=", "st", ".", "nval", ";", "goodNumber", "=", "true", ";", "break", ";", "case", "StreamTokenizer", ".", "TT_WORD", ":", "try", "{", "value", "=", "Double", ".", "parseDouble", "(", "st", ".", "sval", ")", ";", "goodNumber", "=", "true", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "goodNumber", "=", "false", ";", "}", "break", ";", "case", "StreamTokenizer", ".", "TT_EOL", ":", "break", ";", "case", "StreamTokenizer", ".", "TT_EOF", ":", "break", ";", "default", ":", "System", ".", "out", ".", "println", "(", "\"\"", "+", "st", ".", "ttype", ")", ";", "}", "}", "while", "(", "(", "!", "goodNumber", ")", "&&", "(", "st", ".", "ttype", "!=", "StreamTokenizer", ".", "TT_EOF", ")", ")", ";", "return", "value", ";", "}", "public", "boolean", "eof", "(", ")", "{", "return", "(", "st", ".", "ttype", "==", "StreamTokenizer", ".", "TT_EOF", ")", ";", "}", "public", "boolean", "validNumber", "(", ")", "{", "return", "(", "goodNumber", "&&", "(", "st", ".", "ttype", "!=", "StreamTokenizer", ".", "TT_EOF", ")", ")", ";", "}", "public", "ArrayList", "<", "Double", ">", "toList", "(", ")", "throws", "IOException", "{", "ArrayList", "<", "Double", ">", "al", "=", "new", "ArrayList", "<", "Double", ">", "(", "10", ")", ";", "while", "(", "!", "this", ".", "eof", "(", ")", ")", "{", "Double", "dbl", "=", "new", "Double", "(", "this", ".", "next", "(", ")", ")", ";", "if", "(", "this", ".", "validNumber", "(", ")", ")", "al", ".", "add", "(", "dbl", ")", ";", "}", "return", "al", ";", "}", "static", "public", "ArrayList", "<", "Double", ">", "toList", "(", "String", "values", ")", "throws", "IOException", "{", "ParseText", "pt", "=", "new", "ParseText", "(", "values", ")", ";", "return", "pt", ".", "toList", "(", ")", ";", "}", "public", "static", "class", "Test", "{", "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "ParseText", "pt", ";", "if", "(", "args", ".", "length", "<", "1", ")", "pt", "=", "new", "ParseText", "(", "\"\"", ")", ";", "else", "pt", "=", "new", "ParseText", "(", "args", "[", "0", "]", ")", ";", "ArrayList", "<", "Double", ">", "theList", "=", "pt", ".", "toList", "(", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "print", "(", "\"", "[\"", ")", ";", "Iterator", "<", "Double", ">", "listIterator", "=", "theList", ".", "iterator", "(", ")", ";", "while", "(", "listIterator", ".", "hasNext", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "listIterator", ".", "next", "(", ")", ")", ";", "if", "(", "listIterator", ".", "hasNext", "(", ")", ")", "System", ".", "out", ".", "print", "(", "\",", "\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"]\"", ")", ";", "}", "}", "}", "</s>" ]
8,464
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jdom", ".", "Element", ";", "public", "class", "CheckData", "{", "ArrayList", "<", "StaticShot", ">", "staticShots", ";", "public", "CheckData", "(", "List", "<", "Element", ">", "shots", ")", "{", "staticShots", "=", "new", "ArrayList", "<", "StaticShot", ">", "(", "20", ")", ";", "Iterator", "<", "Element", ">", "ssit", "=", "shots", ".", "iterator", "(", ")", ";", "while", "(", "ssit", ".", "hasNext", "(", ")", ")", "staticShots", ".", "add", "(", "new", "StaticShot", "(", "ssit", ".", "next", "(", ")", ")", ")", ";", "}", "public", "ArrayList", "<", "StaticShot", ">", "getStaticShots", "(", ")", "{", "return", "this", ".", "staticShots", ";", "}", "public", "int", "count", "(", ")", "{", "return", "this", ".", "staticShots", ".", "size", "(", ")", ";", "}", "}", "</s>" ]
8,465
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "TreeFileWriter", "extends", "FileWriter", "{", "public", "TreeFileWriter", "(", "String", "fileName", ")", "throws", "IOException", "{", "super", "(", "fileName", ")", ";", "}", "public", "void", "writeln", "(", "String", "cbuf", ")", "throws", "IOException", "{", "super", ".", "write", "(", "cbuf", "+", "\"n\"", ")", ";", "}", "public", "void", "writeln", "(", ")", "throws", "IOException", "{", "super", ".", "write", "(", "\"n\"", ")", ";", "}", "public", "void", "describe", "(", "Model", "m", ")", "throws", "IOException", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "this", ".", "writeln", "(", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "m", ".", "getNumInputBlocks", "(", ")", ")", ";", "this", ".", "writeln", "(", ")", ";", "int", "i", "=", "1", ";", "Iterator", "<", "VectorInfo", ">", "inputIterator", ";", "try", "{", "inputIterator", "=", "m", ".", "getInputVector", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "inputIterator", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "input", ";", "input", "=", "inputIterator", ".", "next", "(", ")", ";", "this", ".", "write", "(", "i", "+", "\"", "\"", ")", ";", "this", ".", "write", "(", "input", ".", "getName", "(", ")", ")", ";", "this", ".", "writeln", "(", "\"", "(\"", "+", "input", ".", "getUnits", "(", ")", "+", "\")\"", ")", ";", "i", "++", ";", "}", "}", "catch", "(", "DAVEException", "ex", ")", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "}", "this", ".", "writeln", "(", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "m", ".", "getNumOutputBlocks", "(", ")", ")", ";", "this", ".", "writeln", "(", ")", ";", "i", "=", "1", ";", "Iterator", "<", "VectorInfo", ">", "outputIterator", ";", "try", "{", "outputIterator", "=", "m", ".", "getOutputVector", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "outputIterator", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "output", ";", "output", "=", "outputIterator", ".", "next", "(", ")", ";", "this", ".", "write", "(", "i", "+", "\"", "\"", ")", ";", "this", ".", "write", "(", "output", ".", "getName", "(", ")", ")", ";", "this", ".", "writeln", "(", "\"", "(\"", "+", "output", ".", "getUnits", "(", ")", "+", "\")\"", ")", ";", "i", "++", ";", "}", "}", "catch", "(", "DAVEException", "ex", ")", "{", "this", ".", "writeln", "(", "\"\"", ")", ";", "}", "this", ".", "writeln", "(", ")", ";", "i", "=", "1", ";", "this", ".", "writeln", "(", "\"\"", "+", "m", ".", "getNumSignals", "(", ")", ")", ";", "this", ".", "writeln", "(", ")", ";", "i", "=", "1", ";", "Iterator", "<", "Signal", ">", "signalIterator", "=", "m", ".", "getSignals", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "signalIterator", ".", "hasNext", "(", ")", ")", "{", "write", "(", "i", "+", "\"", "\"", ")", ";", "(", "signalIterator", ".", "next", "(", ")", ")", ".", "describeSelf", "(", "(", "FileWriter", ")", "this", ")", ";", "this", ".", "writeln", "(", ")", ";", "i", "++", ";", "}", "this", ".", "writeln", "(", ")", ";", "this", ".", "writeln", "(", "\"\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "this", ".", "writeln", "(", ")", ";", "i", "=", "1", ";", "Iterator", "<", "Block", ">", "blockIterator", "=", "m", ".", "getBlocks", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "blockIterator", ".", "hasNext", "(", ")", ")", "{", "write", "(", "i", "+", "\"", "\"", ")", ";", "(", "blockIterator", ".", "next", "(", ")", ")", ".", "describeSelf", "(", "(", "FileWriter", ")", "this", ")", ";", "this", ".", "writeln", "(", ")", ";", "i", "++", ";", "}", "}", "}", "</s>" ]
8,466
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "public", "class", "CodeAndVarNames", "{", "private", "String", "code", ";", "private", "ArrayList", "<", "String", ">", "varName", ";", "public", "CodeAndVarNames", "(", ")", "{", "code", "=", "\"\"", ";", "varName", "=", "new", "ArrayList", "(", "5", ")", ";", "}", "public", "CodeAndVarNames", "(", "String", "theCode", ")", "{", "code", "=", "theCode", ";", "varName", "=", "new", "ArrayList", "(", "0", ")", ";", "}", "public", "void", "append", "(", "CodeAndVarNames", "arg", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "this", ".", "code", "+=", "arg", ".", "code", ";", "this", ".", "varName", ".", "addAll", "(", "arg", ".", "varName", ")", ";", "}", "public", "void", "appendCode", "(", "String", "string", ")", "{", "this", ".", "code", "+=", "string", ";", "}", "public", "void", "prependCode", "(", "String", "string", ")", "{", "this", ".", "code", "=", "string", "+", "this", ".", "code", ";", "}", "public", "void", "addVarName", "(", "String", "varName", ")", "{", "this", ".", "varName", ".", "add", "(", "varName", ")", ";", "}", "public", "ArrayList", "<", "String", ">", "getVarNames", "(", ")", "{", "return", "varName", ";", "}", "public", "String", "getVarName", "(", "int", "i", ")", "{", "return", "varName", ".", "get", "(", "i", ")", ";", "}", "public", "String", "getCode", "(", ")", "{", "return", "code", ";", "}", "}", "</s>" ]
8,467
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "BlockArrayList", "extends", "ArrayList", "<", "Block", ">", "{", "public", "BlockArrayList", "(", ")", "{", "super", "(", ")", ";", "}", "public", "BlockArrayList", "(", "int", "initialCapacity", ")", "{", "super", "(", "initialCapacity", ")", ";", "}", "public", "BlockArrayList", "(", "Collection", "<", "Block", ">", "c", ")", "{", "super", "(", "c", ")", ";", "}", "}", "</s>" ]
8,468
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "public", "class", "VectorInfo", "{", "String", "signalName", ";", "String", "myUnits", ";", "boolean", "isInput", ";", "Block", "source", ";", "Block", "sink", ";", "double", "value", ";", "double", "tolerance", ";", "public", "VectorInfo", "(", ")", "{", "this", ".", "signalName", "=", "\"\"", ";", "this", ".", "myUnits", "=", "\"\"", ";", "this", ".", "source", "=", "null", ";", "this", ".", "sink", "=", "null", ";", "this", ".", "value", "=", "Double", ".", "NaN", ";", "this", ".", "tolerance", "=", "Double", ".", "NaN", ";", "}", "public", "VectorInfo", "(", "String", "signalName", ",", "String", "units", ",", "Block", "blk", ",", "boolean", "isInput", ")", "{", "this", "(", ")", ";", "this", ".", "signalName", "=", "signalName", ";", "this", ".", "myUnits", "=", "units", ";", "if", "(", "isInput", ")", "{", "this", ".", "isInput", "=", "true", ";", "this", ".", "sink", "=", "blk", ";", "this", ".", "source", "=", "null", ";", "}", "else", "{", "this", ".", "isInput", "=", "false", ";", "this", ".", "sink", "=", "null", ";", "this", ".", "source", "=", "blk", ";", "}", "}", "public", "void", "setUnits", "(", "String", "theUnits", ")", "{", "this", ".", "myUnits", "=", "theUnits", ";", "}", "public", "void", "setValue", "(", "double", "theValue", ")", "{", "this", ".", "value", "=", "theValue", ";", "}", "public", "void", "setValue", "(", "String", "theValue", ")", "{", "this", ".", "value", "=", "Double", ".", "parseDouble", "(", "theValue", ")", ";", "}", "public", "void", "setTolerance", "(", "double", "theValue", ")", "{", "this", ".", "tolerance", "=", "theValue", ";", "}", "public", "void", "setTolerance", "(", "String", "theValue", ")", "{", "this", ".", "tolerance", "=", "Double", ".", "parseDouble", "(", "theValue", ")", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "signalName", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "this", ".", "myUnits", ";", "}", "public", "double", "getValue", "(", ")", "{", "return", "this", ".", "value", ";", "}", "public", "double", "getTolerance", "(", ")", "{", "return", "this", ".", "tolerance", ";", "}", "public", "boolean", "isInput", "(", ")", "{", "return", "this", ".", "isInput", ";", "}", "public", "BlockOutput", "getSource", "(", ")", "{", "return", "(", "BlockOutput", ")", "this", ".", "source", ";", "}", "public", "BlockInput", "getSink", "(", ")", "{", "return", "(", "BlockInput", ")", "this", ".", "sink", ";", "}", "}", "</s>" ]
8,469
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "NameList", "extends", "ArrayList", "<", "String", ">", "{", "public", "NameList", "(", ")", "{", "super", "(", ")", ";", "}", "public", "NameList", "(", "int", "initialCapacity", ")", "{", "super", "(", "initialCapacity", ")", ";", "}", "public", "String", "fixName", "(", "String", "s", ")", "{", "return", "s", ";", "}", "public", "boolean", "isUnique", "(", "String", "s", ")", "{", "return", "(", "this", ".", "indexOf", "(", "s", ")", "==", "-", "1", ")", ";", "}", "public", "String", "addUnique", "(", "String", "s", ")", "{", "String", "name", "=", "this", ".", "fixName", "(", "s", ")", ";", "if", "(", "this", ".", "isUnique", "(", "s", ")", ")", "super", ".", "add", "(", "s", ")", ";", "else", "{", "int", "suffix", "=", "1", ";", "while", "(", "!", "this", ".", "isUnique", "(", "s", "+", "suffix", ")", ")", "suffix", "++", ";", "name", "=", "s", "+", "suffix", ";", "super", ".", "add", "(", "name", ")", ";", "}", "return", "name", ";", "}", "}", "</s>" ]
8,470
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathSum", "extends", "BlockMath", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathSum", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"summing\"", ",", "m", ")", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "String", "blockType", "=", "first", ".", "getName", "(", ")", ";", "this", ".", "setName", "(", "blockType", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "!", "blockType", ".", "equals", "(", "\"plus\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", "+", "blockType", ")", ";", "}", "else", "{", "this", ".", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Iterator", "<", "Signal", ">", "inputSig", "=", "inputs", ".", "iterator", "(", ")", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "while", "(", "inputSig", ".", "hasNext", "(", ")", ")", "{", "Signal", "inSig", "=", "inputSig", ".", "next", "(", ")", ";", "cvn", ".", "append", "(", "inSig", ".", "genCode", "(", ")", ")", ";", "if", "(", "inputSig", ".", "hasNext", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "\"", "+", "\"", ")", ";", "}", "}", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "Iterator", "<", "Signal", ">", "theInputs", ";", "double", "[", "]", "inputVals", ";", "Signal", "theInput", ";", "int", "index", ";", "boolean", "verbose", "=", "this", ".", "isVerbose", "(", ")", ";", "if", "(", "verbose", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "theInputs", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "inputVals", "=", "new", "double", "[", "this", ".", "inputs", ".", "size", "(", ")", "]", ";", "index", "=", "0", ";", "while", "(", "theInputs", ".", "hasNext", "(", ")", ")", "{", "theInput", "=", "theInputs", ".", "next", "(", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "else", "{", "inputVals", "[", "index", "]", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "verbose", ")", "System", ".", "out", ".", "println", "(", "\"", "Input", "#\"", "+", "index", "+", "\"", "value", "is", "\"", "+", "inputVals", "[", "index", "]", ")", ";", "}", "index", "++", ";", "}", "this", ".", "value", "=", "0.0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputVals", ".", "length", ";", "i", "++", ")", "this", ".", "value", "+=", "inputVals", "[", "i", "]", ";", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,471
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "PrintStream", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "List", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "org", ".", "jdom", ".", "Namespace", ";", "public", "class", "StaticShot", "{", "String", "scenario", ";", "VectorInfoArrayList", "inputs", ";", "VectorInfoArrayList", "outputs", ";", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "StaticShot", "(", "Element", "staticShot", ")", "{", "this", ".", "scenario", "=", "staticShot", ".", "getAttributeValue", "(", "\"name\"", ")", ";", "Namespace", "ss_ns", "=", "staticShot", ".", "getNamespace", "(", ")", ";", "Element", "checkInputs", "=", "staticShot", ".", "getChild", "(", "\"checkInputs\"", ",", "ss_ns", ")", ";", "if", "(", "checkInputs", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "List", "<", "Element", ">", "theInputs", "=", "checkInputs", ".", "getChildren", "(", "\"signal\"", ",", "ss_ns", ")", ";", "this", ".", "inputs", "=", "new", "VectorInfoArrayList", "(", "theInputs", ".", "size", "(", ")", ")", ";", "Iterator", "<", "Element", ">", "itin", "=", "theInputs", ".", "iterator", "(", ")", ";", "while", "(", "itin", ".", "hasNext", "(", ")", ")", "{", "Element", "theSignal", "=", "itin", ".", "next", "(", ")", ";", "Element", "theUnitsElement", "=", "theSignal", ".", "getChild", "(", "\"signalUnits\"", ",", "ss_ns", ")", ";", "String", "theUnits", "=", "\"\"", ";", "if", "(", "theUnitsElement", "!=", "null", ")", "theUnits", "=", "theUnitsElement", ".", "getTextTrim", "(", ")", ";", "Element", "theSignalName", "=", "theSignal", ".", "getChild", "(", "\"signalName\"", ",", "ss_ns", ")", ";", "if", "(", "theSignalName", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "VectorInfo", "signal", "=", "new", "VectorInfo", "(", "theSignalName", ".", "getTextTrim", "(", ")", ",", "theUnits", ",", "null", ",", "true", ")", ";", "Element", "theSignalValue", "=", "theSignal", ".", "getChild", "(", "\"signalValue\"", ",", "ss_ns", ")", ";", "if", "(", "theSignalValue", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "theSignalName", ".", "getTextTrim", "(", ")", "+", "\"'.\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "signal", ".", "setValue", "(", "theSignal", ".", "getChild", "(", "\"signalValue\"", ",", "ss_ns", ")", ".", "getTextTrim", "(", ")", ")", ";", "this", ".", "inputs", ".", "add", "(", "signal", ")", ";", "}", "Element", "checkOutputs", "=", "staticShot", ".", "getChild", "(", "\"checkOutputs\"", ",", "ss_ns", ")", ";", "if", "(", "checkInputs", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "List", "theOutputs", "=", "checkOutputs", ".", "getChildren", "(", "\"signal\"", ",", "ss_ns", ")", ";", "this", ".", "outputs", "=", "new", "VectorInfoArrayList", "(", "theOutputs", ".", "size", "(", ")", ")", ";", "int", "outCount", "=", "0", ";", "Iterator", "itout", "=", "theOutputs", ".", "iterator", "(", ")", ";", "while", "(", "itout", ".", "hasNext", "(", ")", ")", "{", "outCount", "++", ";", "Element", "theSignal", "=", "(", "Element", ")", "itout", ".", "next", "(", ")", ";", "try", "{", "VectorInfo", "signal", "=", "new", "VectorInfo", "(", "theSignal", ".", "getChild", "(", "\"signalName\"", ",", "ss_ns", ")", ".", "getTextTrim", "(", ")", ",", "null", ",", "null", ",", "false", ")", ";", "signal", ".", "setValue", "(", "theSignal", ".", "getChild", "(", "\"signalValue\"", ",", "ss_ns", ")", ".", "getTextTrim", "(", ")", ")", ";", "signal", ".", "setTolerance", "(", "theSignal", ".", "getChild", "(", "\"tol\"", ",", "ss_ns", ")", ".", "getTextTrim", "(", ")", ")", ";", "Element", "units", "=", "theSignal", ".", "getChild", "(", "\"signalUnits\"", ",", "ss_ns", ")", ";", "if", "(", "units", "==", "null", ")", "signal", ".", "setUnits", "(", "\"\"", ")", ";", "else", "signal", ".", "setUnits", "(", "units", ".", "getTextTrim", "(", ")", ")", ";", "this", ".", "outputs", ".", "add", "(", "signal", ")", ";", "}", "catch", "(", "NullPointerException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "outCount", "+", "\"\"", "+", "this", ".", "scenario", "+", "\"\"", ")", ";", "}", "}", "}", "public", "String", "getName", "(", ")", "{", "return", "this", ".", "scenario", ";", "}", "public", "VectorInfoArrayList", "getInputs", "(", ")", "{", "return", "this", ".", "inputs", ";", "}", "public", "VectorInfoArrayList", "getOutputs", "(", ")", "{", "return", "this", ".", "outputs", ";", "}", "public", "void", "loadInputVector", "(", "VectorInfoArrayList", "inVec", ")", "throws", "DAVEException", "{", "VectorInfo", "modelSig", "=", "null", ";", "VectorInfo", "checkSig", "=", "null", ";", "if", "(", "inVec", ".", "size", "(", ")", "!=", "this", ".", "inputs", ".", "size", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'", "(\"", "+", "this", ".", "inputs", ".", "size", "(", ")", "+", "\"\"", "+", "inVec", ".", "size", "(", ")", "+", "\").\"", ")", ";", "Iterator", "<", "VectorInfo", ">", "checkIt", "=", "this", ".", "inputs", ".", "iterator", "(", ")", ";", "while", "(", "checkIt", ".", "hasNext", "(", ")", ")", "{", "checkSig", "=", "checkIt", ".", "next", "(", ")", ";", "String", "sigName", "=", "checkSig", ".", "getName", "(", ")", ";", "boolean", "matched", "=", "false", ";", "Iterator", "<", "VectorInfo", ">", "modelIt", "=", "inVec", ".", "iterator", "(", ")", ";", "while", "(", "!", "matched", ")", "{", "if", "(", "!", "modelIt", ".", "hasNext", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "sigName", "+", "\"\"", ")", ";", "modelSig", "=", "modelIt", ".", "next", "(", ")", ";", "if", "(", "checkSig", ".", "getName", "(", ")", ".", "equals", "(", "modelSig", ".", "getName", "(", ")", ")", ")", "matched", "=", "true", ";", "}", "if", "(", "!", "checkSig", ".", "getUnits", "(", ")", ".", "equals", "(", "modelSig", ".", "getUnits", "(", ")", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "sigName", "+", "\"\"", "+", "checkSig", ".", "getUnits", "(", ")", "+", "\"\"", "+", "modelSig", ".", "getUnits", "(", ")", "+", "\"'.\"", ")", ";", "if", "(", "!", "modelSig", ".", "isInput", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "modelSig", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "modelSig", ".", "setValue", "(", "checkSig", ".", "getValue", "(", ")", ")", ";", "}", "}", "public", "boolean", "checkOutputs", "(", "VectorInfoArrayList", "outVec", ")", "throws", "DAVEException", "{", "return", "checkOutputs", "(", "outVec", ",", "System", ".", "out", ")", ";", "}", "public", "boolean", "checkOutputs", "(", "VectorInfoArrayList", "outVec", ",", "PrintStream", "out", ")", "throws", "DAVEException", "{", "boolean", "comparison", "=", "true", ";", "VectorInfo", "modelSig", "=", "null", ";", "VectorInfo", "checkSig", "=", "null", ";", "if", "(", "outVec", ".", "size", "(", ")", "<", "this", ".", "outputs", ".", "size", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'", "(\"", "+", "this", ".", "outputs", ".", "size", "(", ")", "+", "\"\"", "+", "outVec", ".", "size", "(", ")", "+", "\").\"", ")", ";", "Iterator", "<", "VectorInfo", ">", "checkIt", "=", "this", ".", "outputs", ".", "iterator", "(", ")", ";", "while", "(", "checkIt", ".", "hasNext", "(", ")", ")", "{", "checkSig", "=", "checkIt", ".", "next", "(", ")", ";", "String", "sigName", "=", "checkSig", ".", "getName", "(", ")", ";", "boolean", "matched", "=", "false", ";", "Iterator", "<", "VectorInfo", ">", "modelIt", "=", "outVec", ".", "iterator", "(", ")", ";", "while", "(", "!", "matched", ")", "{", "if", "(", "!", "modelIt", ".", "hasNext", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "sigName", "+", "\"\"", ")", ";", "modelSig", "=", "modelIt", ".", "next", "(", ")", ";", "if", "(", "checkSig", ".", "getName", "(", ")", ".", "equals", "(", "modelSig", ".", "getName", "(", ")", ")", ")", "matched", "=", "true", ";", "}", "if", "(", "!", "checkSig", ".", "getUnits", "(", ")", ".", "equals", "(", "modelSig", ".", "getUnits", "(", ")", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "sigName", "+", "\"\"", "+", "checkSig", ".", "getUnits", "(", ")", "+", "\"\"", "+", "modelSig", ".", "getUnits", "(", ")", "+", "\"'.\"", ")", ";", "if", "(", "modelSig", ".", "isInput", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "modelSig", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "double", "actual", "=", "modelSig", ".", "getValue", "(", ")", ";", "double", "expected", "=", "checkSig", ".", "getValue", "(", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "actual", ")", ")", "if", "(", "!", "Double", ".", "isNaN", "(", "expected", ")", ")", "{", "comparison", "=", "false", ";", "out", ".", "println", "(", ")", ";", "out", ".", "println", "(", "\"For", "output", "'\"", "+", "sigName", "+", "\"\"", ")", ";", "}", "if", "(", "Double", ".", "isNaN", "(", "expected", ")", ")", "if", "(", "!", "Double", ".", "isNaN", "(", "actual", ")", ")", "{", "comparison", "=", "false", ";", "out", ".", "println", "(", ")", ";", "out", ".", "println", "(", "\"For", "output", "'\"", "+", "sigName", "+", "\"\"", "+", "actual", "+", "\".\"", ")", ";", "}", "if", "(", "Double", ".", "isNaN", "(", "expected", ")", "&&", "Double", ".", "isNaN", "(", "actual", ")", ")", "{", "}", "else", "{", "double", "diff", "=", "Math", ".", "abs", "(", "actual", "-", "expected", ")", ";", "double", "tol", "=", "Math", ".", "abs", "(", "checkSig", ".", "getTolerance", "(", ")", ")", ";", "if", "(", "diff", ">", "tol", ")", "{", "comparison", "=", "false", ";", "out", ".", "println", "(", ")", ";", "out", ".", "println", "(", "\"For", "output", "'\"", "+", "sigName", "+", "\"':", "expected", "\"", "+", "expected", ")", ";", "out", ".", "println", "(", "\"", "but", "found", "\"", "+", "actual", "+", "\"\"", "+", "diff", ")", ";", "out", ".", "println", "(", "\"\"", "+", "tol", "+", "\".\"", ")", ";", "}", "}", "}", "return", "comparison", ";", "}", "}", "</s>" ]
8,472
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockBP", "extends", "Block", "{", "BreakpointSet", "bpSet", ";", "public", "BlockBP", "(", "String", "bpID", ",", "String", "ourName", ",", "Signal", "inSignal", ",", "Signal", "outSignal", ",", "Model", "m", ")", "throws", "DAVEException", "{", "super", "(", "ourName", ",", "\"\"", ",", "1", ",", "m", ")", ";", "this", ".", "bpSet", "=", "m", ".", "getBPSetByID", "(", "bpID", ")", ";", "if", "(", "this", ".", "bpSet", "==", "null", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "bpID", "+", "\"'.\"", ")", ";", "}", "this", ".", "bpSet", ".", "register", "(", "this", ")", ";", "m", ".", "register", "(", "this", ")", ";", "inSignal", ".", "addSink", "(", "this", ",", "1", ")", ";", "try", "{", "this", ".", "addOutput", "(", "outSignal", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "public", "String", "getBPID", "(", ")", "{", "return", "this", ".", "bpSet", ".", "getBPID", "(", ")", ";", "}", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "Signal", "theInput", ";", "double", "inputValue", ";", "double", "bpValue", ";", "double", "prevValue", ";", "double", "frac", "=", "0", ";", "int", "index", "=", "0", ";", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "this", ".", "value", "=", "Double", ".", "NaN", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "this", ".", "inputs", ".", "size", "(", ")", ">", "1", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "theInput", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "theInput", "==", "null", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "inputValue", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", ")", ";", "Iterator", "<", "Double", ">", "bpIt", "=", "this", ".", "bpSet", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "if", "(", "!", "bpIt", ".", "hasNext", "(", ")", ")", "throw", "new", "DAVEException", "(", "\"\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "bpValue", "=", "(", "bpIt", ".", "next", "(", ")", ")", ".", "doubleValue", "(", ")", ";", "prevValue", "=", "bpValue", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "prevValue", ")", ";", "if", "(", "bpValue", ">", "inputValue", ")", "{", "this", ".", "value", "=", "0", ";", "frac", "=", "0", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", "+", "\"\"", "+", "bpValue", ")", ";", "}", "else", "while", "(", "bpIt", ".", "hasNext", "(", ")", ")", "{", "bpValue", "=", "(", "bpIt", ".", "next", "(", ")", ")", ".", "doubleValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "bpValue", "+", "\"\"", "+", "prevValue", ")", ";", "if", "(", "bpValue", ">", "inputValue", ")", "{", "this", ".", "value", "=", "(", "double", ")", "index", ";", "frac", "=", "(", "inputValue", "-", "prevValue", ")", "/", "(", "bpValue", "-", "prevValue", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "bpValue", "+", "\"", "at", "index", "\"", "+", "index", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "prevValue", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "frac", ")", ";", "}", "break", ";", "}", "else", "{", "index", "++", ";", "prevValue", "=", "bpValue", ";", "}", "}", "if", "(", "bpValue", "<=", "inputValue", ")", "{", "this", ".", "value", "=", "this", ".", "bpSet", ".", "length", "(", ")", "-", "1", ";", "frac", "=", "0", ";", "}", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "this", ".", "value", "=", "this", ".", "value", "+", "frac", ";", "if", "(", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "value", ")", ";", "}", "public", "int", "length", "(", ")", "{", "return", "this", ".", "bpSet", ".", "length", "(", ")", ";", "}", "public", "BreakpointSet", "getBPset", "(", ")", "{", "return", "this", ".", "bpSet", ";", "}", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", "+", "this", ".", "length", "(", ")", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
8,473
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "org", ".", "jdom", ".", "Element", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "io", ".", "Writer", ";", "import", "java", ".", "util", ".", "List", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "BlockMathMinus", "extends", "BlockMath", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "BlockMathMinus", "(", "Element", "applyElement", ",", "Model", "m", ")", "{", "super", "(", "\"pending\"", ",", "\"minus\"", ",", "m", ")", ";", "List", "<", "Element", ">", "kids", "=", "applyElement", ".", "getChildren", "(", ")", ";", "if", "(", "kids", ".", "size", "(", ")", "<", "2", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "if", "(", "kids", ".", "size", "(", ")", ">", "3", ")", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "Iterator", "<", "Element", ">", "ikid", "=", "kids", ".", "iterator", "(", ")", ";", "Element", "first", "=", "ikid", ".", "next", "(", ")", ";", "this", ".", "setName", "(", "first", ".", "getName", "(", ")", "+", "\"_\"", "+", "m", ".", "getNumBlocks", "(", ")", ")", ";", "if", "(", "!", "first", ".", "getName", "(", ")", ".", "equals", "(", "\"minus\"", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "}", "else", "genInputsFromApply", "(", "ikid", ",", "1", ")", ";", "}", "@", "Override", "public", "CodeAndVarNames", "genCode", "(", ")", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "Signal", "input0", ",", "input1", ";", "Signal", "outputSig", "=", "this", ".", "getOutput", "(", ")", ";", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "{", "cvn", ".", "appendCode", "(", "indent", "(", ")", "+", "outVarID", "+", "\"", "=", "\"", ")", ";", "cvn", ".", "addVarName", "(", "outVarID", ")", ";", "}", "input0", "=", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "inputs", ".", "size", "(", ")", "==", "1", ")", "{", "cvn", ".", "appendCode", "(", "\"-\"", ")", ";", "cvn", ".", "append", "(", "input0", ".", "genCode", "(", ")", ")", ";", "}", "else", "{", "input1", "=", "inputs", ".", "get", "(", "1", ")", ";", "cvn", ".", "append", "(", "input0", ".", "genCode", "(", ")", ")", ";", "cvn", ".", "appendCode", "(", "\"", "-", "\"", ")", ";", "cvn", ".", "append", "(", "input1", ".", "genCode", "(", ")", ")", ";", "}", "if", "(", "!", "outputSig", ".", "isDerived", "(", ")", ")", "cvn", ".", "appendCode", "(", "endLine", "(", ")", ")", ";", "return", "cvn", ";", "}", "@", "Override", "public", "void", "describeSelf", "(", "Writer", "writer", ")", "throws", "IOException", "{", "super", ".", "describeSelf", "(", "writer", ")", ";", "writer", ".", "write", "(", "\"\"", ")", ";", "}", "@", "Override", "public", "void", "update", "(", ")", "throws", "DAVEException", "{", "if", "(", "isVerbose", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", "+", "this", ".", "getName", "(", ")", "+", "\"'\"", ")", ";", "}", "int", "numInputs", "=", "this", ".", "inputs", ".", "size", "(", ")", ";", "if", "(", "numInputs", "<", "1", ")", "throw", "new", "DAVEException", "(", "\"Minus", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "numInputs", ">", "2", ")", "throw", "new", "DAVEException", "(", "\"Minus", "block", "\"", "+", "this", ".", "myName", "+", "\"\"", ")", ";", "if", "(", "numInputs", "==", "1", ")", "{", "Signal", "theInput", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "if", "(", "!", "theInput", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "theInput", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "double", "inputValue", "=", "theInput", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "inputValue", ")", ";", "this", ".", "value", "=", "-", "inputValue", ";", "}", "else", "{", "Signal", "minuend", "=", "this", ".", "inputs", ".", "get", "(", "0", ")", ";", "assert", "(", "minuend", "!=", "null", ")", ";", "if", "(", "!", "minuend", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "minuend", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "Signal", "subtrahend", "=", "this", ".", "inputs", ".", "get", "(", "1", ")", ";", "assert", "(", "subtrahend", "!=", "null", ")", ";", "if", "(", "!", "subtrahend", ".", "sourceReady", "(", ")", ")", "{", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "subtrahend", ".", "getName", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "double", "minuendValue", "=", "minuend", ".", "sourceValue", "(", ")", ";", "double", "subtrahendValue", "=", "subtrahend", ".", "sourceValue", "(", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "System", ".", "out", ".", "println", "(", "\"\"", "+", "minuendValue", "+", "\";\"", "+", "\"\"", "+", "subtrahendValue", ")", ";", "this", ".", "value", "=", "minuendValue", "-", "subtrahendValue", ";", "}", "resultsCycleCount", "=", "ourModel", ".", "getCycleCounter", "(", ")", ";", "}", "}", "</s>" ]
8,474
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave", ";", "import", "java", ".", "util", ".", "Collection", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "@", "SuppressWarnings", "(", "\"serial\"", ")", "public", "class", "SignalArrayList", "extends", "ArrayList", "<", "Signal", ">", "{", "public", "SignalArrayList", "(", ")", "{", "super", "(", ")", ";", "}", "public", "SignalArrayList", "(", "int", "initialCapacity", ")", "{", "super", "(", "initialCapacity", ")", ";", "}", "public", "SignalArrayList", "(", "Collection", "<", "Signal", ">", "c", ")", "{", "super", "(", "c", ")", ";", "}", "public", "Signal", "findByID", "(", "String", "ID", ")", "{", "Iterator", "<", "Signal", ">", "signalIterator", "=", "this", ".", "iterator", "(", ")", ";", "while", "(", "signalIterator", ".", "hasNext", "(", ")", ")", "{", "Signal", "theSignal", "=", "signalIterator", ".", "next", "(", ")", ";", "if", "(", "ID", ".", "equals", "(", "theSignal", ".", "getVarID", "(", ")", ")", ")", "return", "theSignal", ";", "}", "return", "null", ";", "}", "@", "Deprecated", "public", "SignalArrayList", "findDanglingFuncInputs", "(", ")", "{", "SignalArrayList", "funcInputs", "=", "new", "SignalArrayList", "(", "this", ".", "size", "(", ")", ")", ";", "BlockArrayList", "bal", ";", "Iterator", "<", "Block", ">", "i", ";", "Iterator", "<", "Signal", ">", "signalIterator", "=", "this", ".", "iterator", "(", ")", ";", "while", "(", "signalIterator", ".", "hasNext", "(", ")", ")", "{", "Signal", "s", "=", "signalIterator", ".", "next", "(", ")", ";", "bal", "=", "s", ".", "getDests", "(", ")", ";", "i", "=", "bal", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "Block", "b", "=", "i", ".", "next", "(", ")", ";", "if", "(", "b", "instanceof", "BlockFuncTable", ")", "{", "Block", "a", "=", "s", ".", "getSource", "(", ")", ";", "if", "(", "!", "(", "a", "instanceof", "BlockBP", ")", ")", "funcInputs", ".", "add", "(", "s", ")", ";", "break", ";", "}", "}", "}", "return", "funcInputs", ";", "}", "}", "</s>" ]
8,475
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2post", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "Iterator", ";", "public", "class", "DAVE2POST", "extends", "DAVE", "{", "String", "tableFileName", ";", "String", "sourceFileName", ";", "public", "DAVE2POST", "(", ")", "{", "super", "(", ")", ";", "}", "public", "DAVE2POST", "(", "String", "[", "]", "args", ")", "{", "this", "(", ")", ";", "this", ".", "parseOptions", "(", "args", ")", ";", "if", "(", "this", ".", "isVerbose", "(", ")", ")", "{", "this", ".", "getModel", "(", ")", ".", "makeVerbose", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "setInputFileName", "(", "String", "fn", ")", "{", "super", ".", "setInputFileName", "(", "fn", ")", ";", "this", ".", "tableFileName", "=", "this", ".", "getStubName", "(", ")", "+", "\".pos2\"", ";", "this", ".", "sourceFileName", "=", "this", ".", "getStubName", "(", ")", "+", "\".f\"", ";", "}", "private", "void", "parseOptions", "(", "String", "inArgs", "[", "]", ")", "{", "String", "exampleUse", "=", "\"\"", ";", "int", "numArgs", "=", "inArgs", ".", "length", ";", "this", ".", "setArgs", "(", "inArgs", ")", ";", "if", "(", "numArgs", ">", "0", ")", "{", "int", "parsedArgs", "=", "0", ";", "if", "(", "this", ".", "matchOptionArgs", "(", "\"c\"", ",", "\"count\"", ")", ")", "{", "this", ".", "setGenStatsFlag", "(", ")", ";", "parsedArgs", "++", ";", "}", "if", "(", "this", ".", "matchOptionArgs", "(", "\"d\"", ",", "\"debug\"", ")", ")", "{", "this", ".", "makeVerbose", "(", ")", ";", "parsedArgs", "++", ";", "}", "if", "(", "matchOptionArgs", "(", "\"v\"", ",", "\"version\"", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", "+", "getVersion", "(", ")", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "if", "(", "parsedArgs", "<", "(", "numArgs", "-", "1", ")", ")", "{", "if", "(", "numArgs", "==", "2", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "getArgs", "(", ")", "[", "2", "]", "+", "\"'.\"", ")", ";", "}", "else", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "numArgs", "-", "1", ")", "+", "\"\"", ")", ";", "}", "System", ".", "err", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "}", "else", "{", "System", ".", "out", ".", "println", "(", "exampleUse", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "this", ".", "setInputFileName", "(", "inArgs", "[", "numArgs", "-", "1", "]", ")", ";", "}", "public", "void", "createModel", "(", ")", "throws", "IOException", "{", "Model", "theModel", "=", "this", ".", "getModel", "(", ")", ";", "File", "file", "=", "new", "File", "(", "this", ".", "getStubName", "(", ")", ")", ";", "String", "modelName", "=", "file", ".", "getName", "(", ")", ";", "PostTableFileWriter", "tableWriter", "=", "new", "PostTableFileWriter", "(", "theModel", ",", "this", ".", "tableFileName", ")", ";", "FEquationsFileWriter", "equationWriter", "=", "new", "FEquationsFileWriter", "(", "theModel", ",", "this", ".", "sourceFileName", ")", ";", "equationWriter", ".", "writeFcode", "(", ")", ";", "BlockArrayList", "blocks", "=", "theModel", ".", "getBlocks", "(", ")", ";", "Iterator", "<", "Block", ">", "it", "=", "blocks", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "Block", "blk", "=", "it", ".", "next", "(", ")", ";", "if", "(", "blk", "instanceof", "BlockFuncTable", ")", "{", "BlockFuncTable", "bft", "=", "(", "BlockFuncTable", ")", "blk", ";", "tableWriter", ".", "generateTableDescription", "(", "bft", ")", ";", "}", "}", "tableWriter", ".", "close", "(", ")", ";", "equationWriter", ".", "close", "(", ")", ";", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "boolean", "success", "=", "false", ";", "DAVE2POST", "dave2post", "=", "new", "DAVE2POST", "(", "args", ")", ";", "try", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "success", "=", "dave2post", ".", "parseFile", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "if", "(", "!", "success", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "try", "{", "if", "(", "dave2post", ".", "hasCheckcases", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "if", "(", "!", "dave2post", ".", "verify", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "}", "}", "catch", "(", "NoSuchMethodError", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "try", "{", "if", "(", "dave2post", ".", "getGenStatsFlag", "(", ")", ")", "{", "dave2post", ".", "reportStats", "(", ")", ";", "}", "}", "catch", "(", "NoSuchMethodError", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "try", "{", "dave2post", ".", "createModel", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", ";", "}", "System", ".", "out", ".", "println", "(", "\"\"", "+", "dave2post", ".", "getStubName", "(", ")", "+", "\".\"", ")", ";", "}", "}", "</s>" ]
8,476
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2post", ";", "</s>" ]
8,477
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2post", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "class", "CEquationsFileWriter", "extends", "FileWriter", "{", "Model", "ourModel", ";", "public", "CEquationsFileWriter", "(", "Model", "theModel", ",", "String", "sourceFileName", ")", "throws", "IOException", "{", "super", "(", "sourceFileName", ")", ";", "ourModel", "=", "theModel", ";", "}", "void", "generateTableCall", "(", "BlockFuncTable", "bft", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}", "</s>" ]
8,478
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2post", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "class", "PostTableFileWriter", "extends", "FileWriter", "{", "int", "tableNumber", ",", "tableRefNumber", ";", "Model", "ourModel", ";", "String", "indent", ";", "public", "PostTableFileWriter", "(", "Model", "theModel", ",", "String", "tableFileName", ")", "throws", "IOException", "{", "super", "(", "tableFileName", ")", ";", "ourModel", "=", "theModel", ";", "indent", "=", "\"", "\"", ";", "}", "public", "void", "writeln", "(", "String", "cbuf", ")", "throws", "IOException", "{", "super", ".", "write", "(", "cbuf", "+", "\"n\"", ")", ";", "}", "void", "generateTableDescription", "(", "BlockFuncTable", "bft", ")", "{", "tableNumber", "=", "0", ";", "tableRefNumber", "=", "1", ";", "String", "outVarID", "=", "bft", ".", "getOutputVarID", "(", ")", ";", "FuncTable", "ft", "=", "bft", ".", "getFunctionTableDef", "(", ")", ";", "int", "[", "]", "dims", "=", "ft", ".", "getDimensions", "(", ")", ";", "int", "numDims", "=", "dims", ".", "length", ";", "String", "gtID", "=", "ft", ".", "getGTID", "(", ")", ";", "try", "{", "writeln", "(", "\"C", "Table\"", "+", "\"'\"", "+", "gtID", "+", "\"',", "dim", "=", "\"", "+", "numDims", "+", "\".\"", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PostTableFileWriter", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "if", "(", "numDims", "==", "1", ")", "{", "this", ".", "writeMonoTable", "(", "bft", ",", "0", ")", ";", "}", "else", "{", "int", "offset", "=", "0", ";", "this", ".", "writeMultiTables", "(", "bft", ",", "0", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "dims", "[", "numDims", "-", "2", "]", ";", "i", "++", ")", "{", "offset", "=", "this", ".", "writeMonoTable", "(", "bft", ",", "offset", ")", ";", "}", "}", "}", "private", "void", "writeMultiTables", "(", "BlockFuncTable", "bft", ",", "int", "dimLevel", ")", "{", "FuncTable", "ft", "=", "bft", ".", "getFunctionTableDef", "(", ")", ";", "String", "outVarID", "=", "bft", ".", "getOutputVarID", "(", ")", ";", "int", "[", "]", "dims", "=", "ft", ".", "getDimensions", "(", ")", ";", "int", "numDims", "=", "dims", ".", "length", ";", "if", "(", "dimLevel", ">=", "(", "numDims", "-", "1", ")", ")", "{", "return", ";", "}", "else", "{", "String", "inVarID", "=", "bft", ".", "getVarID", "(", "dimLevel", "+", "1", ")", ";", "String", "bpID", "=", "ft", ".", "getBPID", "(", "dimLevel", "+", "1", ")", ";", "ArrayList", "<", "Double", ">", "bps", "=", "ourModel", ".", "getBPSetByID", "(", "bpID", ")", ".", "values", "(", ")", ";", "Iterator", "<", "Double", ">", "bpIt", "=", "bps", ".", "iterator", "(", ")", ";", "try", "{", "write", "(", "\"", "\"", "+", "outVarID", "+", "\"t", "=", "\"", "+", "outVarID", "+", "\"t,", "multi,", "\"", "+", "inVarID", ")", ";", "writeln", "(", "\",", "\"", "+", "tableNumber", "++", "+", "\"\"", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PostTableFileWriter", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "while", "(", "bpIt", ".", "hasNext", "(", ")", ")", "{", "double", "breakpointVal", "=", "bpIt", ".", "next", "(", ")", ";", "try", "{", "writeln", "(", "indent", "+", "breakpointVal", "+", "\",", "\"", "+", "tableRefNumber", "++", "+", "\",\"", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PostTableFileWriter", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}", "writeMultiTables", "(", "bft", ",", "dimLevel", "+", "1", ")", ";", "}", "}", "private", "int", "writeMonoTable", "(", "BlockFuncTable", "bft", ",", "int", "offset", ")", "{", "FuncTable", "ft", "=", "bft", ".", "getFunctionTableDef", "(", ")", ";", "String", "outVarID", "=", "bft", ".", "getOutputVarID", "(", ")", ";", "int", "[", "]", "dims", "=", "ft", ".", "getDimensions", "(", ")", ";", "int", "numDims", "=", "dims", ".", "length", ";", "String", "bpID", "=", "ft", ".", "getBPID", "(", "numDims", ")", ";", "String", "inVarID", "=", "bft", ".", "getVarID", "(", "numDims", ")", ";", "ArrayList", "<", "Double", ">", "bps", "=", "ourModel", ".", "getBPSetByID", "(", "bpID", ")", ".", "values", "(", ")", ";", "ArrayList", "<", "Double", ">", "vals", "=", "ft", ".", "getValues", "(", ")", ";", "try", "{", "write", "(", "\"", "\"", "+", "outVarID", "+", "\"t", "=", "\"", "+", "outVarID", "+", "\"t,", "monovar,", "\"", "+", "inVarID", ")", ";", "writeln", "(", "\",", "\"", "+", "tableNumber", "+", "\"\"", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PostTableFileWriter", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "offset", "=", "this", ".", "generate1DTable", "(", "bps", ",", "vals", ",", "offset", ")", ";", "tableNumber", "++", ";", "return", "offset", ";", "}", "private", "int", "generate1DTable", "(", "ArrayList", "<", "Double", ">", "bps", ",", "ArrayList", "<", "Double", ">", "vals", ",", "int", "valOffset", ")", "{", "int", "i", "=", "0", ";", "if", "(", "bps", ".", "size", "(", ")", ">", "(", "vals", ".", "size", "(", ")", "-", "valOffset", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "(", "vals", ".", "size", "(", ")", "-", "valOffset", ")", "+", "\"\"", "+", "bps", ".", "size", "(", ")", ")", ";", "}", "else", "{", "for", "(", "i", "=", "0", ";", "i", "<", "bps", ".", "size", "(", ")", ";", "i", "++", ")", "{", "try", "{", "writeln", "(", "indent", "+", "bps", ".", "get", "(", "i", ")", "+", "\",", "\"", "+", "vals", ".", "get", "(", "i", "+", "valOffset", ")", "+", "\",\"", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "PostTableFileWriter", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}", "}", "return", "valOffset", "+", "i", ";", "}", "}", "</s>" ]
8,479
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "dave2post", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "*", ";", "import", "java", ".", "io", ".", "FileWriter", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Collections", ";", "import", "java", ".", "util", ".", "HashSet", ";", "import", "java", ".", "util", ".", "Iterator", ";", "class", "FEquationsFileWriter", "extends", "FileWriter", "{", "Model", "ourModel", ";", "String", "indent", ";", "public", "FEquationsFileWriter", "(", "Model", "theModel", ",", "String", "sourceFileName", ")", "throws", "IOException", "{", "super", "(", "sourceFileName", ")", ";", "ourModel", "=", "theModel", ";", "indent", "=", "\"", "\"", ";", "}", "public", "void", "writeln", "(", "String", "cbuf", ")", "throws", "IOException", "{", "super", ".", "write", "(", "cbuf", "+", "\"n\"", ")", ";", "}", "public", "void", "writeFcode", "(", ")", "throws", "IOException", "{", "CodeAndVarNames", "cvn", "=", "new", "CodeAndVarNames", "(", ")", ";", "BlockArrayList", "sortedBlocks", ";", "BlockArrayList", "outputBlocks", "=", "new", "BlockArrayList", "(", "10", ")", ";", "Iterator", "<", "Block", ">", "blkIt", ";", "Block", "blk", ";", "String", "codeBody", "=", "\"\"", ";", "String", "codeDeclarations", "=", "\"\"", ";", "ourModel", ".", "setCodeDialect", "(", "Model", ".", "DT_FORTRAN", ")", ";", "try", "{", "sortedBlocks", "=", "ourModel", ".", "getSortedBlocks", "(", ")", ";", "if", "(", "sortedBlocks", ".", "isEmpty", "(", ")", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", "+", "\"\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "blkIt", "=", "sortedBlocks", ".", "iterator", "(", ")", ";", "while", "(", "blkIt", ".", "hasNext", "(", ")", ")", "{", "blk", "=", "blkIt", ".", "next", "(", ")", ";", "boolean", "skip", "=", "false", ";", "if", "(", "blk", "instanceof", "BlockLimiter", "||", "blk", "instanceof", "BlockMathSwitch", ")", "blk", ".", "getOutput", "(", ")", ".", "clearDerivedFlag", "(", ")", ";", "Signal", "outSig", "=", "blk", ".", "getOutput", "(", ")", ";", "if", "(", "outSig", "!=", "null", ")", "if", "(", "outSig", ".", "isDerived", "(", ")", ")", "skip", "=", "true", ";", "if", "(", "blk", "instanceof", "BlockBP", ")", "{", "}", "else", "if", "(", "blk", "instanceof", "BlockOutput", ")", "{", "outputBlocks", ".", "add", "(", "blk", ")", ";", "}", "else", "if", "(", "blk", "instanceof", "BlockFuncTable", ")", "{", "cvn", ".", "appendCode", "(", "this", ".", "generateTableCall", "(", "(", "BlockFuncTable", ")", "blk", ")", ")", ";", "}", "else", "{", "if", "(", "!", "skip", ")", "cvn", ".", "append", "(", "blk", ".", "genCode", "(", ")", ")", ";", "}", "}", "blkIt", "=", "outputBlocks", ".", "iterator", "(", ")", ";", "while", "(", "blkIt", ".", "hasNext", "(", ")", ")", "{", "cvn", ".", "append", "(", "blkIt", ".", "next", "(", ")", ".", "genCode", "(", ")", ")", ";", "codeBody", "=", "cvn", ".", "getCode", "(", ")", ";", "}", "codeDeclarations", "=", "\"\"", ";", "ArrayList", "<", "String", ">", "varNames", "=", "cvn", ".", "getVarNames", "(", ")", ";", "ArrayList", "<", "String", ">", "uniqueNames", "=", "new", "ArrayList", "<", "String", ">", "(", "new", "HashSet", "(", "varNames", ")", ")", ";", "Collections", ".", "sort", "(", "uniqueNames", ",", "String", ".", "CASE_INSENSITIVE_ORDER", ")", ";", "Iterator", "<", "String", ">", "varIt", "=", "uniqueNames", ".", "iterator", "(", ")", ";", "while", "(", "varIt", ".", "hasNext", "(", ")", ")", "{", "codeDeclarations", "+=", "indent", "+", "\"REAL", "\"", "+", "varIt", ".", "next", "(", ")", "+", "\"n\"", ";", "}", "write", "(", "codeDeclarations", ")", ";", "write", "(", "codeBody", ")", ";", "writeln", "(", "indent", "+", "\"STOP\"", ")", ";", "writeln", "(", "indent", "+", "\"END\"", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"\"", ")", ";", "}", "}", "private", "String", "generateTableCall", "(", "BlockFuncTable", "bft", ")", "{", "String", "outVarID", "=", "bft", ".", "getOutputVarID", "(", ")", ";", "return", "indent", "+", "outVarID", "+", "\"\"", "+", "outVarID", "+", "\"t(1))n\"", ";", "}", "}", "</s>" ]
8,480
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "sweeper", ";", "import", "org", ".", "math", ".", "plot", ".", "Plot3DPanel", ";", "import", "org", ".", "math", ".", "plot", ".", "render", ".", "Projection", ";", "import", "javax", ".", "swing", ".", "JTable", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "javax", ".", "swing", ".", "JTextField", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVE", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVEException", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "Model", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfo", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfoArrayList", ";", "import", "java", ".", "io", ".", "File", ";", "import", "java", ".", "io", ".", "IOException", ";", "import", "java", ".", "util", ".", "ListIterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "import", "javax", ".", "swing", ".", "JFileChooser", ";", "import", "static", "org", ".", "math", ".", "array", ".", "DoubleArray", ".", "*", ";", "class", "DMLFilter", "extends", "javax", ".", "swing", ".", "filechooser", ".", "FileFilter", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "file", ")", "{", "return", "file", ".", "isDirectory", "(", ")", "||", "file", ".", "getAbsolutePath", "(", ")", ".", "endsWith", "(", "\".xml\"", ")", "||", "file", ".", "getAbsolutePath", "(", ")", ".", "endsWith", "(", "\".dml\"", ")", ";", "}", "@", "Override", "public", "String", "getDescription", "(", ")", "{", "return", "\"\"", ";", "}", "}", "public", "class", "ModelSweeperUI", "extends", "javax", ".", "swing", ".", "JFrame", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "42L", ";", "File", "inputFile", ";", "VectorInfoArrayList", "inputVec", ";", "VectorInfoArrayList", "outputVec", ";", "Model", "model", ";", "boolean", "plotReady", ";", "int", "numPts", ";", "int", "input1Selector", ";", "int", "input2Selector", ";", "int", "outputSelector", ";", "InputTable", "inputTable", ";", "InputTableJFrame", "inputTableJFrame", ";", "Plot3DPanel", "plot", ";", "int", "plotSurface", ";", "Projection", "projection", ";", "public", "ModelSweeperUI", "(", ")", "{", "inputFile", "=", "null", ";", "inputTable", "=", "null", ";", "inputVec", "=", "null", ";", "outputVec", "=", "null", ";", "model", "=", "null", ";", "numPts", "=", "10", ";", "plotReady", "=", "false", ";", "plot", "=", "null", ";", "inputTableJFrame", "=", "null", ";", "initComponents", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initComponents", "(", ")", "{", "jPanel4", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "jPanel3", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "inputSignals", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jSeparator4", "=", "new", "javax", ".", "swing", ".", "JSeparator", "(", ")", ";", "input1ComboBox", "=", "new", "javax", ".", "swing", ".", "JComboBox", "(", ")", ";", "jLabel2", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "input1MinValTextField", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "jLabel3", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "input1MaxValTextField", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "input2ComboBox", "=", "new", "javax", ".", "swing", ".", "JComboBox", "(", ")", ";", "jLabel7", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "input2MinValTextField", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "jLabel8", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "input2MaxValTextField", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "jSeparator5", "=", "new", "javax", ".", "swing", ".", "JSeparator", "(", ")", ";", "jPanel1", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "modelFileNameTextField", "=", "new", "javax", ".", "swing", ".", "JTextField", "(", ")", ";", "browseButton", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jPanel2", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "Coarser", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "Denser", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jPanel5", "=", "new", "javax", ".", "swing", ".", "JPanel", "(", ")", ";", "plotFrame", "=", "new", "javax", ".", "swing", ".", "JInternalFrame", "(", ")", ";", "outputSignalComboBox", "=", "new", "javax", ".", "swing", ".", "JComboBox", "(", ")", ";", "setDefaultCloseOperation", "(", "javax", ".", "swing", ".", "WindowConstants", ".", "EXIT_ON_CLOSE", ")", ";", "jPanel3", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"Model", "Inputs\"", ")", ")", ";", "inputSignals", ".", "setText", "(", "\"Inputs", "Table\"", ")", ";", "inputSignals", ".", "setEnabled", "(", "false", ")", ";", "inputSignals", ".", "setMaximumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "110", ",", "29", ")", ")", ";", "inputSignals", ".", "setMinimumSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "110", ",", "29", ")", ")", ";", "inputSignals", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "inputSignalsActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "input1ComboBox", ".", "setModel", "(", "new", "javax", ".", "swing", ".", "DefaultComboBoxModel", "(", "new", "String", "[", "]", "{", "\"Input", "1\"", ",", "\"Input", "2\"", ",", "\"Input", "3\"", ",", "\"Input", "4\"", "}", ")", ")", ";", "input1ComboBox", ".", "setEnabled", "(", "false", ")", ";", "input1ComboBox", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "260", ",", "27", ")", ")", ";", "input1ComboBox", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input1ComboBoxActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jLabel2", ".", "setText", "(", "\"from\"", ")", ";", "input1MinValTextField", ".", "setHorizontalAlignment", "(", "javax", ".", "swing", ".", "JTextField", ".", "TRAILING", ")", ";", "input1MinValTextField", ".", "setText", "(", "\"0.0\"", ")", ";", "input1MinValTextField", ".", "setEnabled", "(", "false", ")", ";", "input1MinValTextField", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input1MinValTextFieldActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "input1MinValTextField", ".", "addInputMethodListener", "(", "new", "java", ".", "awt", ".", "event", ".", "InputMethodListener", "(", ")", "{", "public", "void", "inputMethodTextChanged", "(", "java", ".", "awt", ".", "event", ".", "InputMethodEvent", "evt", ")", "{", "input1MinValTextFieldInputMethodTextChanged", "(", "evt", ")", ";", "}", "public", "void", "caretPositionChanged", "(", "java", ".", "awt", ".", "event", ".", "InputMethodEvent", "evt", ")", "{", "}", "}", ")", ";", "jLabel3", ".", "setText", "(", "\"to\"", ")", ";", "input1MaxValTextField", ".", "setHorizontalAlignment", "(", "javax", ".", "swing", ".", "JTextField", ".", "TRAILING", ")", ";", "input1MaxValTextField", ".", "setText", "(", "\"0.0\"", ")", ";", "input1MaxValTextField", ".", "setEnabled", "(", "false", ")", ";", "input1MaxValTextField", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input1MaxValTextFieldActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "input2ComboBox", ".", "setModel", "(", "new", "javax", ".", "swing", ".", "DefaultComboBoxModel", "(", "new", "String", "[", "]", "{", "\"Input", "2\"", ",", "\"Input", "3\"", ",", "\"Input", "4\"", ",", "\"", "\"", "}", ")", ")", ";", "input2ComboBox", ".", "setEnabled", "(", "false", ")", ";", "input2ComboBox", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "260", ",", "27", ")", ")", ";", "input2ComboBox", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input2ComboBoxActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jLabel7", ".", "setText", "(", "\"from\"", ")", ";", "input2MinValTextField", ".", "setHorizontalAlignment", "(", "javax", ".", "swing", ".", "JTextField", ".", "TRAILING", ")", ";", "input2MinValTextField", ".", "setText", "(", "\"0.0\"", ")", ";", "input2MinValTextField", ".", "setEnabled", "(", "false", ")", ";", "input2MinValTextField", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input2MinValTextFieldActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "jLabel8", ".", "setText", "(", "\"to\"", ")", ";", "input2MaxValTextField", ".", "setHorizontalAlignment", "(", "javax", ".", "swing", ".", "JTextField", ".", "TRAILING", ")", ";", "input2MaxValTextField", ".", "setText", "(", "\"0.0\"", ")", ";", "input2MaxValTextField", ".", "setEnabled", "(", "false", ")", ";", "input2MaxValTextField", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "input2MaxValTextFieldActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "jPanel3Layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "jPanel3", ")", ";", "jPanel3", ".", "setLayout", "(", "jPanel3Layout", ")", ";", "jPanel3Layout", ".", "setHorizontalGroup", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel3Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel3Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "8", ",", "8", ",", "8", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "CENTER", ")", ".", "add", "(", "input1ComboBox", ",", "0", ",", "242", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "input2ComboBox", ",", "0", ",", "242", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "jSeparator4", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "242", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "jSeparator5", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "242", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ".", "add", "(", "jPanel3Layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jLabel2", ")", ".", "add", "(", "jLabel7", ")", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "input1MinValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "70", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "input2MinValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "70", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jLabel3", ")", ".", "add", "(", "jLabel8", ")", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "input1MaxValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "70", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "input2MaxValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "69", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ")", ".", "add", "(", "inputSignals", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "250", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "jPanel3Layout", ".", "linkSize", "(", "new", "java", ".", "awt", ".", "Component", "[", "]", "{", "input1MaxValTextField", ",", "input1MinValTextField", ",", "input2MaxValTextField", ",", "input2MinValTextField", "}", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "HORIZONTAL", ")", ";", "jPanel3Layout", ".", "setVerticalGroup", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel3Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "inputSignals", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "3", ",", "3", ",", "3", ")", ".", "add", "(", "jSeparator4", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "10", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "18", ",", "18", ",", "18", ")", ".", "add", "(", "input1ComboBox", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "UNRELATED", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "BASELINE", ")", ".", "add", "(", "jLabel2", ")", ".", "add", "(", "input1MinValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "jLabel3", ")", ".", "add", "(", "input1MaxValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "add", "(", "5", ",", "5", ",", "5", ")", ".", "add", "(", "jSeparator5", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "10", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "18", ",", "18", ",", "18", ")", ".", "add", "(", "input2ComboBox", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel3Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "BASELINE", ")", ".", "add", "(", "input2MinValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "jLabel8", ")", ".", "add", "(", "input2MaxValTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "jLabel7", ")", ")", ".", "addContainerGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "jPanel1", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"Model\"", ")", ")", ";", "modelFileNameTextField", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "modelFileNameTextFieldActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "browseButton", ".", "setText", "(", "\"Browse...\"", ")", ";", "browseButton", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "browseButtonActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "jPanel1Layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "jPanel1", ")", ";", "jPanel1", ".", "setLayout", "(", "jPanel1Layout", ")", ";", "jPanel1Layout", ".", "setHorizontalGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel1Layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "modelFileNameTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "199", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "browseButton", ")", ")", ".", "addContainerGap", "(", "38", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "jPanel1Layout", ".", "setVerticalGroup", "(", "jPanel1Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel1Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "modelFileNameTextField", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "UNRELATED", ")", ".", "add", "(", "browseButton", ")", ")", ")", ";", "jPanel2", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"Mesh", "Density\"", ")", ")", ";", "Coarser", ".", "setText", "(", "\"Halve\"", ")", ";", "Coarser", ".", "setEnabled", "(", "false", ")", ";", "Coarser", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "CoarserActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "Denser", ".", "setText", "(", "\"Double\"", ")", ";", "Denser", ".", "setEnabled", "(", "false", ")", ";", "Denser", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "DenserActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "jPanel2Layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "jPanel2", ")", ";", "jPanel2", ".", "setLayout", "(", "jPanel2Layout", ")", ";", "jPanel2Layout", ".", "setHorizontalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel2Layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "Denser", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ",", "9", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "Coarser", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "107", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "jPanel2Layout", ".", "linkSize", "(", "new", "java", ".", "awt", ".", "Component", "[", "]", "{", "Coarser", ",", "Denser", "}", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "HORIZONTAL", ")", ";", "jPanel2Layout", ".", "setVerticalGroup", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel2Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "jPanel2Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "BASELINE", ")", ".", "add", "(", "Denser", ")", ".", "add", "(", "Coarser", ")", ")", ".", "addContainerGap", "(", "9", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "jPanel5", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createTitledBorder", "(", "\"Model", "Output\"", ")", ")", ";", "plotFrame", ".", "setBorder", "(", "javax", ".", "swing", ".", "BorderFactory", ".", "createEtchedBorder", "(", ")", ")", ";", "plotFrame", ".", "setPreferredSize", "(", "new", "java", ".", "awt", ".", "Dimension", "(", "700", ",", "553", ")", ")", ";", "plotFrame", ".", "setVisible", "(", "true", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "plotFrameLayout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "plotFrame", ".", "getContentPane", "(", ")", ")", ";", "plotFrame", ".", "getContentPane", "(", ")", ".", "setLayout", "(", "plotFrameLayout", ")", ";", "plotFrameLayout", ".", "setHorizontalGroup", "(", "plotFrameLayout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "0", ",", "817", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "plotFrameLayout", ".", "setVerticalGroup", "(", "plotFrameLayout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "0", ",", "678", ",", "Short", ".", "MAX_VALUE", ")", ")", ";", "outputSignalComboBox", ".", "setModel", "(", "new", "javax", ".", "swing", ".", "DefaultComboBoxModel", "(", "new", "String", "[", "]", "{", "\"Output", "1\"", ",", "\"Output", "2\"", ",", "\"Output", "3\"", ",", "\"Output", "4\"", "}", ")", ")", ";", "outputSignalComboBox", ".", "setEnabled", "(", "false", ")", ";", "outputSignalComboBox", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "outputSignalComboBoxActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "jPanel5Layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "jPanel5", ")", ";", "jPanel5", ".", "setLayout", "(", "jPanel5Layout", ")", ";", "jPanel5Layout", ".", "setHorizontalGroup", "(", "jPanel5Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel5Layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jPanel5Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "plotFrame", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "821", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "outputSignalComboBox", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "393", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "jPanel5Layout", ".", "setVerticalGroup", "(", "jPanel5Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel5Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "outputSignalComboBox", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "UNRELATED", ")", ".", "add", "(", "plotFrame", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "682", ",", "Short", ".", "MAX_VALUE", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "jPanel4Layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "jPanel4", ")", ";", "jPanel4", ".", "setLayout", "(", "jPanel4Layout", ")", ";", "jPanel4Layout", ".", "setHorizontalGroup", "(", "jPanel4Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel4Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "jPanel4Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "TRAILING", ",", "false", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ",", "jPanel2", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ",", "jPanel1", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ",", "jPanel3", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "269", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "add", "(", "18", ",", "18", ",", "18", ")", ".", "add", "(", "jPanel5", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "jPanel4Layout", ".", "setVerticalGroup", "(", "jPanel4Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel4Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "jPanel4Layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "jPanel4Layout", ".", "createSequentialGroup", "(", ")", ".", "add", "(", "jPanel1", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel3", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "RELATED", ")", ".", "add", "(", "jPanel2", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "66", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "add", "(", "jPanel5", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ")", ".", "addContainerGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "getContentPane", "(", ")", ")", ";", "getContentPane", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jPanel4", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jPanel4", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "780", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "pack", "(", ")", ";", "}", "private", "void", "input1MinValTextFieldActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "Double", "val", "=", "new", "Double", "(", "input1MinValTextField", ".", "getText", "(", ")", ")", ";", "inputTable", ".", "setMinVal", "(", "input1Selector", ",", "val", ")", ";", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "browseButtonActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "final", "JFileChooser", "fc", "=", "new", "JFileChooser", "(", ")", ";", "fc", ".", "setFileFilter", "(", "new", "DMLFilter", "(", ")", ")", ";", "int", "returnVal", "=", "fc", ".", "showOpenDialog", "(", "this", ")", ";", "if", "(", "returnVal", "==", "JFileChooser", ".", "APPROVE_OPTION", ")", "{", "inputFile", "=", "fc", ".", "getSelectedFile", "(", ")", ";", "plotReady", "=", "false", ";", "this", ".", "loadModel", "(", ")", ";", "}", "}", "private", "void", "modelFileNameTextFieldActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "}", "private", "void", "outputSignalComboBoxActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "outputSelector", "=", "outputSignalComboBox", ".", "getSelectedIndex", "(", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "input1ComboBoxActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "int", "sel", "=", "input1ComboBox", ".", "getSelectedIndex", "(", ")", ";", "if", "(", "(", "sel", ">", "-", "1", ")", "&&", "(", "sel", "!=", "input2Selector", ")", ")", "{", "input1Selector", "=", "sel", ";", "setMinMaxLabels", "(", "input1MinValTextField", ",", "input1MaxValTextField", ",", "input1Selector", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "}", "private", "void", "input2ComboBoxActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "int", "sel", "=", "input2ComboBox", ".", "getSelectedIndex", "(", ")", ";", "if", "(", "(", "sel", ">", "-", "1", ")", "&&", "(", "sel", "!=", "input1Selector", ")", ")", "{", "input2Selector", "=", "sel", ";", "setMinMaxLabels", "(", "input2MinValTextField", ",", "input2MaxValTextField", ",", "input2Selector", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "}", "private", "void", "input1MaxValTextFieldActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "Double", "val", "=", "new", "Double", "(", "input1MaxValTextField", ".", "getText", "(", ")", ")", ";", "inputTable", ".", "setMaxVal", "(", "input1Selector", ",", "val", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "input2MinValTextFieldActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "Double", "val", "=", "new", "Double", "(", "input2MinValTextField", ".", "getText", "(", ")", ")", ";", "inputTable", ".", "setMinVal", "(", "input2Selector", ",", "val", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "input2MaxValTextFieldActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "Double", "val", "=", "new", "Double", "(", "input2MaxValTextField", ".", "getText", "(", ")", ")", ";", "inputTable", ".", "setMaxVal", "(", "input2Selector", ",", "val", ")", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "DenserActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "numPts", "=", "2", "*", "numPts", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "CoarserActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "numPts", "=", "numPts", "/", "2", ";", "if", "(", "numPts", "<", "2", ")", "numPts", "=", "2", ";", "if", "(", "plotReady", ")", "doPlot", "(", ")", ";", "}", "private", "void", "inputSignalsActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "if", "(", "inputTable", "!=", "null", ")", "{", "if", "(", "inputTableJFrame", "==", "null", ")", "{", "inputTableJFrame", "=", "new", "InputTableJFrame", "(", ")", ";", "}", "if", "(", "inputTableJFrame", "!=", "null", ")", "{", "JTable", "theTable", "=", "inputTableJFrame", ".", "getTable", "(", ")", ";", "theTable", ".", "setModel", "(", "inputTable", ")", ";", "inputTable", ".", "setJFrame", "(", "inputTableJFrame", ")", ";", "inputTableJFrame", ".", "setVisible", "(", "true", ")", ";", "}", "}", "}", "private", "void", "input1MinValTextFieldInputMethodTextChanged", "(", "java", ".", "awt", ".", "event", ".", "InputMethodEvent", "evt", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "private", "void", "doPlot", "(", ")", "{", "double", "xmin", "=", "inputTable", ".", "getMinVal", "(", "input1Selector", ")", ";", "double", "xmax", "=", "inputTable", ".", "getMaxVal", "(", "input1Selector", ")", ";", "double", "delx", "=", "(", "xmax", "-", "xmin", ")", "/", "numPts", ";", "double", "ymin", "=", "inputTable", ".", "getMinVal", "(", "input2Selector", ")", ";", "double", "ymax", "=", "inputTable", ".", "getMaxVal", "(", "input2Selector", ")", ";", "double", "dely", "=", "(", "ymax", "-", "ymin", ")", "/", "numPts", ";", "double", "[", "]", "x", "=", "{", "xmin", ",", "xmax", "}", ";", "if", "(", "delx", ">", "0", ")", "{", "x", "=", "increment", "(", "xmin", ",", "delx", ",", "xmax", ")", ";", "}", "double", "[", "]", "y", "=", "{", "ymin", ",", "ymax", "}", ";", "if", "(", "dely", ">", "0", ")", "{", "y", "=", "increment", "(", "ymin", ",", "dely", ",", "ymax", ")", ";", "}", "double", "[", "]", "[", "]", "z", "=", "sweepModel", "(", "x", ",", "y", ",", "input1Selector", ",", "input2Selector", ",", "outputSelector", ",", "inputTable", ",", "model", ")", ";", "if", "(", "plot", "==", "null", ")", "{", "plot", "=", "new", "Plot3DPanel", "(", "\"NORTH\"", ")", ";", "plot", ".", "setPlotToolBarOrientation", "(", "\"SOUTH\"", ")", ";", "plotFrame", ".", "setContentPane", "(", "plot", ")", ";", "}", "else", "{", "plot", ".", "removePlot", "(", "plotSurface", ")", ";", "}", "plot", ".", "setAxisLabel", "(", "0", ",", "(", "String", ")", "input1ComboBox", ".", "getItemAt", "(", "input1Selector", ")", ")", ";", "plot", ".", "setAxisLabel", "(", "1", ",", "(", "String", ")", "input2ComboBox", ".", "getItemAt", "(", "input2Selector", ")", ")", ";", "plot", ".", "setAxisLabel", "(", "2", ",", "(", "String", ")", "outputSignalComboBox", ".", "getItemAt", "(", "outputSelector", ")", ")", ";", "plotSurface", "=", "plot", ".", "addGridPlot", "(", "outputVec", ".", "get", "(", "outputSelector", ")", ".", "getName", "(", ")", ",", "x", ",", "y", ",", "z", ")", ";", "plotReady", "=", "true", ";", "}", "private", "void", "loadModel", "(", ")", "{", "inputVec", "=", "null", ";", "outputVec", "=", "null", ";", "DAVE", "dave", "=", "new", "DAVE", "(", ")", ";", "dave", ".", "setInputFileName", "(", "inputFile", ".", "getAbsolutePath", "(", ")", ")", ";", "boolean", "keepGoing", "=", "true", ";", "try", "{", "keepGoing", "=", "dave", ".", "parseFile", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "ModelSweeperUI", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "keepGoing", "=", "false", ";", "}", "keepGoing", "=", "dave", ".", "verify", "(", ")", ";", "if", "(", "keepGoing", ")", "{", "model", "=", "dave", ".", "getModel", "(", ")", ";", "modelFileNameTextField", ".", "setText", "(", "model", ".", "getName", "(", ")", ")", ";", "try", "{", "inputVec", "=", "model", ".", "getInputVector", "(", ")", ";", "outputVec", "=", "model", ".", "getOutputVector", "(", ")", ";", "keepGoing", "=", "true", ";", "if", "(", "inputVec", "==", "null", ")", "{", "keepGoing", "=", "false", ";", "}", "else", "if", "(", "inputVec", ".", "isEmpty", "(", ")", ")", "{", "keepGoing", "=", "false", ";", "}", "if", "(", "outputVec", "==", "null", ")", "{", "keepGoing", "=", "false", ";", "}", "else", "if", "(", "outputVec", ".", "isEmpty", "(", ")", ")", "{", "keepGoing", "=", "false", ";", "}", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "ModelSweeperUI", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "keepGoing", "=", "false", ";", "}", "}", "if", "(", "keepGoing", ")", "{", "inputTable", "=", "new", "InputTable", "(", "dave", ",", "this", ")", ";", "clearAndLoadComboBox", "(", "input1ComboBox", ",", "inputVec", ")", ";", "clearAndLoadComboBox", "(", "input2ComboBox", ",", "inputVec", ")", ";", "clearAndLoadComboBox", "(", "outputSignalComboBox", ",", "outputVec", ")", ";", "input1Selector", "=", "0", ";", "input2Selector", "=", "1", ";", "outputSelector", "=", "0", ";", "input1ComboBox", ".", "setSelectedIndex", "(", "input1Selector", ")", ";", "input2ComboBox", ".", "setSelectedIndex", "(", "input2Selector", ")", ";", "outputSignalComboBox", ".", "setSelectedIndex", "(", "outputSelector", ")", ";", "setMinMaxLabels", "(", "input1MinValTextField", ",", "input1MaxValTextField", ",", "input1Selector", ")", ";", "setMinMaxLabels", "(", "input2MinValTextField", ",", "input2MaxValTextField", ",", "input2Selector", ")", ";", "}", "if", "(", "!", "keepGoing", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "plotReady", "=", "true", ";", "enableControls", "(", ")", ";", "doPlot", "(", ")", ";", "}", "private", "void", "enableControls", "(", ")", "{", "input1ComboBox", ".", "setEnabled", "(", "true", ")", ";", "input2ComboBox", ".", "setEnabled", "(", "true", ")", ";", "inputSignals", ".", "setEnabled", "(", "true", ")", ";", "input1MinValTextField", ".", "setEnabled", "(", "true", ")", ";", "input2MinValTextField", ".", "setEnabled", "(", "true", ")", ";", "input1MaxValTextField", ".", "setEnabled", "(", "true", ")", ";", "input2MaxValTextField", ".", "setEnabled", "(", "true", ")", ";", "outputSignalComboBox", ".", "setEnabled", "(", "true", ")", ";", "Coarser", ".", "setEnabled", "(", "true", ")", ";", "Denser", ".", "setEnabled", "(", "true", ")", ";", "}", "private", "void", "setMinMaxLabels", "(", "JTextField", "minField", ",", "JTextField", "maxField", ",", "int", "inSel", ")", "{", "Double", "val", ";", "val", "=", "new", "Double", "(", "inputTable", ".", "getMinVal", "(", "inSel", ")", ")", ";", "minField", ".", "setText", "(", "val", ".", "toString", "(", ")", ")", ";", "val", "=", "new", "Double", "(", "inputTable", ".", "getMaxVal", "(", "inSel", ")", ")", ";", "maxField", ".", "setText", "(", "val", ".", "toString", "(", ")", ")", ";", "}", "private", "void", "clearAndLoadComboBox", "(", "javax", ".", "swing", ".", "JComboBox", "comboBox", ",", "VectorInfoArrayList", "vec", ")", "{", "for", "(", "int", "i", "=", "comboBox", ".", "getItemCount", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "comboBox", ".", "removeItemAt", "(", "i", ")", ";", "}", "ListIterator", "it", "=", "vec", ".", "listIterator", "(", ")", ";", "int", "index", "=", "0", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "signal", "=", "(", "VectorInfo", ")", "it", ".", "next", "(", ")", ";", "String", "name", "=", "signal", ".", "getName", "(", ")", ";", "String", "units", "=", "signal", ".", "getUnits", "(", ")", ";", "if", "(", "units", ".", "length", "(", ")", ">", "0", ")", "{", "name", "=", "name", "+", "\"_\"", "+", "units", ";", "}", "comboBox", ".", "insertItemAt", "(", "name", ",", "index", ")", ";", "index", "++", ";", "}", "comboBox", ".", "setSelectedIndex", "(", "0", ")", ";", "comboBox", ".", "setMaximumRowCount", "(", "index", ")", ";", "}", "private", "static", "void", "dumpVec", "(", "VectorInfoArrayList", "vec", ")", "{", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "Iterator", "it", "=", "vec", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "vi", "=", "(", "VectorInfo", ")", "it", ".", "next", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"", "\"", "+", "vi", ".", "getName", "(", ")", "+", "\"", "=", "\"", "+", "vi", ".", "getValue", "(", ")", ")", ";", "}", "}", "void", "updateInputInfo", "(", "int", "rowIndex", ")", "{", "if", "(", "rowIndex", "==", "input1Selector", ")", "{", "setMinMaxLabels", "(", "input1MinValTextField", ",", "input1MaxValTextField", ",", "rowIndex", ")", ";", "}", "if", "(", "rowIndex", "==", "input2Selector", ")", "{", "setMinMaxLabels", "(", "input2MinValTextField", ",", "input2MaxValTextField", ",", "rowIndex", ")", ";", "}", "}", "public", "static", "double", "sweepModel", "(", "double", "x", ",", "double", "y", ",", "int", "input1Selector", ",", "int", "input2Selector", ",", "int", "outputSelector", ",", "InputTable", "inputTable", ",", "Model", "model", ")", "{", "VectorInfoArrayList", "inputVec", "=", "null", ";", "VectorInfoArrayList", "outputVec", "=", "null", ";", "try", "{", "inputVec", "=", "model", ".", "getInputVector", "(", ")", ";", "outputVec", "=", "model", ".", "getOutputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "ModelSweeperUI", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "inputTable", ".", "loadNominalValues", "(", "inputVec", ")", ";", "VectorInfo", "input1", "=", "inputVec", ".", "get", "(", "input1Selector", ")", ";", "VectorInfo", "input2", "=", "inputVec", ".", "get", "(", "input2Selector", ")", ";", "input1", ".", "setValue", "(", "x", ")", ";", "input2", ".", "setValue", "(", "y", ")", ";", "inputVec", ".", "set", "(", "input1Selector", ",", "input1", ")", ";", "inputVec", ".", "set", "(", "input2Selector", ",", "input2", ")", ";", "try", "{", "model", ".", "cycle", "(", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "ModelSweeperUI", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "System", ".", "exit", "(", "0", ")", ";", "}", "VectorInfo", "output", "=", "outputVec", ".", "get", "(", "outputSelector", ")", ";", "return", "output", ".", "getValue", "(", ")", ";", "}", "public", "static", "double", "[", "]", "[", "]", "sweepModel", "(", "double", "[", "]", "x", ",", "double", "[", "]", "y", ",", "int", "input1Selector", ",", "int", "input2Selector", ",", "int", "outputSelector", ",", "InputTable", "inputTable", ",", "Model", "model", ")", "{", "double", "[", "]", "[", "]", "z", "=", "new", "double", "[", "y", ".", "length", "]", "[", "x", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "x", ".", "length", ";", "i", "++", ")", "for", "(", "int", "j", "=", "0", ";", "j", "<", "y", ".", "length", ";", "j", "++", ")", "z", "[", "j", "]", "[", "i", "]", "=", "sweepModel", "(", "x", "[", "i", "]", ",", "y", "[", "j", "]", ",", "input1Selector", ",", "input2Selector", ",", "outputSelector", ",", "inputTable", ",", "model", ")", ";", "return", "z", ";", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "java", ".", "awt", ".", "EventQueue", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "new", "ModelSweeperUI", "(", ")", ".", "setVisible", "(", "true", ")", ";", "}", "}", ")", ";", "}", "private", "javax", ".", "swing", ".", "JButton", "Coarser", ";", "private", "javax", ".", "swing", ".", "JButton", "Denser", ";", "private", "javax", ".", "swing", ".", "JButton", "browseButton", ";", "private", "javax", ".", "swing", ".", "JComboBox", "input1ComboBox", ";", "private", "javax", ".", "swing", ".", "JTextField", "input1MaxValTextField", ";", "private", "javax", ".", "swing", ".", "JTextField", "input1MinValTextField", ";", "private", "javax", ".", "swing", ".", "JComboBox", "input2ComboBox", ";", "private", "javax", ".", "swing", ".", "JTextField", "input2MaxValTextField", ";", "private", "javax", ".", "swing", ".", "JTextField", "input2MinValTextField", ";", "private", "javax", ".", "swing", ".", "JButton", "inputSignals", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel2", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel3", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel7", ";", "private", "javax", ".", "swing", ".", "JLabel", "jLabel8", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel1", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel2", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel3", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel4", ";", "private", "javax", ".", "swing", ".", "JPanel", "jPanel5", ";", "private", "javax", ".", "swing", ".", "JSeparator", "jSeparator4", ";", "private", "javax", ".", "swing", ".", "JSeparator", "jSeparator5", ";", "private", "javax", ".", "swing", ".", "JTextField", "modelFileNameTextField", ";", "private", "javax", ".", "swing", ".", "JComboBox", "outputSignalComboBox", ";", "private", "javax", ".", "swing", ".", "JInternalFrame", "plotFrame", ";", "}", "</s>" ]
8,481
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "sweeper", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfo", ";", "public", "class", "InputInfo", "{", "VectorInfo", "orig", ";", "double", "min", ";", "double", "max", ";", "double", "nominal", ";", "public", "InputInfo", "(", "VectorInfo", "aVectorInfo", ")", "{", "orig", "=", "aVectorInfo", ";", "min", "=", "0.", ";", "max", "=", "0.", ";", "nominal", "=", "0.", ";", "}", "public", "String", "getName", "(", ")", "{", "return", "orig", ".", "getName", "(", ")", ";", "}", "public", "String", "getUnits", "(", ")", "{", "return", "orig", ".", "getUnits", "(", ")", ";", "}", "double", "getMin", "(", ")", "{", "return", "min", ";", "}", "double", "getMax", "(", ")", "{", "return", "max", ";", "}", "double", "getNominal", "(", ")", "{", "return", "nominal", ";", "}", "void", "setMin", "(", "double", "newMin", ")", "{", "min", "=", "newMin", ";", "}", "void", "setMax", "(", "double", "newMax", ")", "{", "max", "=", "newMax", ";", "}", "void", "setMinMax", "(", "double", "newVal", ")", "{", "if", "(", "newVal", ">", "max", ")", "{", "max", "=", "newVal", ";", "}", "if", "(", "newVal", "<", "min", ")", "{", "min", "=", "newVal", ";", "}", "}", "void", "setNominal", "(", "double", "newNominal", ")", "{", "nominal", "=", "newNominal", ";", "}", "void", "setNominal", "(", ")", "{", "nominal", "=", "0.5", "*", "(", "min", "+", "max", ")", ";", "}", "}", "</s>" ]
8,482
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "sweeper", ";", "</s>" ]
8,483
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "sweeper", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "CheckData", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVE", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVEException", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "Model", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "StaticShot", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfo", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfoArrayList", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "ListIterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "InputTableJFrame", "extends", "javax", ".", "swing", ".", "JFrame", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "41L", ";", "public", "InputTableJFrame", "(", ")", "{", "initComponents", "(", ")", ";", "}", "public", "javax", ".", "swing", ".", "JTable", "getTable", "(", ")", "{", "return", "jTable1", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "initComponents", "(", ")", "{", "jScrollPane1", "=", "new", "javax", ".", "swing", ".", "JScrollPane", "(", ")", ";", "jTable1", "=", "new", "javax", ".", "swing", ".", "JTable", "(", ")", ";", "jLabelModelName", "=", "new", "javax", ".", "swing", ".", "JLabel", "(", ")", ";", "jOKButton", "=", "new", "javax", ".", "swing", ".", "JButton", "(", ")", ";", "jTable1", ".", "setModel", "(", "new", "javax", ".", "swing", ".", "table", ".", "DefaultTableModel", "(", "new", "Object", "[", "]", "[", "]", "{", "}", ",", "new", "String", "[", "]", "{", "\"Signal", "Name\"", ",", "\"Units\"", ",", "\"\"", ",", "\"\"", ",", "\"\"", "}", ")", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "40L", ";", "Class", "[", "]", "types", "=", "new", "Class", "[", "]", "{", "java", ".", "lang", ".", "String", ".", "class", ",", "java", ".", "lang", ".", "String", ".", "class", ",", "java", ".", "lang", ".", "Double", ".", "class", ",", "java", ".", "lang", ".", "Double", ".", "class", ",", "java", ".", "lang", ".", "Double", ".", "class", "}", ";", "boolean", "[", "]", "canEdit", "=", "new", "boolean", "[", "]", "{", "false", ",", "false", ",", "true", ",", "true", ",", "true", "}", ";", "public", "Class", "getColumnClass", "(", "int", "columnIndex", ")", "{", "return", "types", "[", "columnIndex", "]", ";", "}", "public", "boolean", "isCellEditable", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "return", "canEdit", "[", "columnIndex", "]", ";", "}", "}", ")", ";", "jTable1", ".", "setColumnSelectionAllowed", "(", "true", ")", ";", "jTable1", ".", "setSelectionMode", "(", "javax", ".", "swing", ".", "ListSelectionModel", ".", "SINGLE_SELECTION", ")", ";", "jTable1", ".", "setShowGrid", "(", "true", ")", ";", "jTable1", ".", "getTableHeader", "(", ")", ".", "setReorderingAllowed", "(", "false", ")", ";", "jScrollPane1", ".", "setViewportView", "(", "jTable1", ")", ";", "jTable1", ".", "getColumnModel", "(", ")", ".", "getSelectionModel", "(", ")", ".", "setSelectionMode", "(", "javax", ".", "swing", ".", "ListSelectionModel", ".", "SINGLE_SELECTION", ")", ";", "jTable1", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "1", ")", ".", "setPreferredWidth", "(", "5", ")", ";", "jLabelModelName", ".", "setText", "(", "\"Model", "Inputs\"", ")", ";", "jOKButton", ".", "setText", "(", "\"OK\"", ")", ";", "jOKButton", ".", "addActionListener", "(", "new", "java", ".", "awt", ".", "event", ".", "ActionListener", "(", ")", "{", "public", "void", "actionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "jOKButtonActionPerformed", "(", "evt", ")", ";", "}", "}", ")", ";", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "layout", "=", "new", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", "(", "getContentPane", "(", ")", ")", ";", "getContentPane", "(", ")", ".", "setLayout", "(", "layout", ")", ";", "layout", ".", "setHorizontalGroup", "(", "layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "TRAILING", ",", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "TRAILING", ")", ".", "add", "(", "jOKButton", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ",", "jScrollPane1", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "584", ",", "Short", ".", "MAX_VALUE", ")", ".", "add", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ",", "jLabelModelName", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "584", ",", "Short", ".", "MAX_VALUE", ")", ")", ".", "addContainerGap", "(", ")", ")", ")", ";", "layout", ".", "setVerticalGroup", "(", "layout", ".", "createParallelGroup", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "LEADING", ")", ".", "add", "(", "layout", ".", "createSequentialGroup", "(", ")", ".", "addContainerGap", "(", ")", ".", "add", "(", "jLabelModelName", ")", ".", "addPreferredGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "LayoutStyle", ".", "UNRELATED", ")", ".", "add", "(", "jScrollPane1", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ",", "286", ",", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "PREFERRED_SIZE", ")", ".", "add", "(", "18", ",", "18", ",", "18", ")", ".", "add", "(", "jOKButton", ")", ".", "addContainerGap", "(", "org", ".", "jdesktop", ".", "layout", ".", "GroupLayout", ".", "DEFAULT_SIZE", ",", "Short", ".", "MAX_VALUE", ")", ")", ")", ";", "pack", "(", ")", ";", "}", "private", "void", "jOKButtonActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "this", ".", "setVisible", "(", "false", ")", ";", "}", "public", "static", "void", "main", "(", "String", "args", "[", "]", ")", "{", "java", ".", "awt", ".", "EventQueue", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "new", "InputTableJFrame", "(", ")", ".", "setVisible", "(", "true", ")", ";", "}", "}", ")", ";", "}", "private", "javax", ".", "swing", ".", "JLabel", "jLabelModelName", ";", "private", "javax", ".", "swing", ".", "JButton", "jOKButton", ";", "private", "javax", ".", "swing", ".", "JScrollPane", "jScrollPane1", ";", "private", "javax", ".", "swing", ".", "JTable", "jTable1", ";", "public", "void", "setModelName", "(", "String", "name", ")", "{", "jLabelModelName", ".", "setText", "(", "name", "+", "\"\"", ")", ";", "}", "}", "</s>" ]
8,484
[ "<s>", "package", "gov", ".", "nasa", ".", "daveml", ".", "sweeper", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "CheckData", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVE", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "DAVEException", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "Model", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "StaticShot", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfo", ";", "import", "gov", ".", "nasa", ".", "daveml", ".", "dave", ".", "VectorInfoArrayList", ";", "import", "java", ".", "util", ".", "ArrayList", ";", "import", "java", ".", "util", ".", "Iterator", ";", "import", "java", ".", "util", ".", "ListIterator", ";", "import", "java", ".", "util", ".", "logging", ".", "Level", ";", "import", "java", ".", "util", ".", "logging", ".", "Logger", ";", "public", "class", "InputTable", "extends", "javax", ".", "swing", ".", "table", ".", "AbstractTableModel", "{", "private", "static", "final", "long", "serialVersionUID", "=", "-", "40L", ";", "Model", "m", ";", "ArrayList", "<", "InputInfo", ">", "array", ";", "InputTableJFrame", "parentJFrame", ";", "ModelSweeperUI", "uiClass", ";", "public", "InputTable", "(", "DAVE", "d", ",", "ModelSweeperUI", "mainClass", ")", "{", "parentJFrame", "=", "null", ";", "uiClass", "=", "mainClass", ";", "InputInfo", "modelInput", ";", "VectorInfoArrayList", "vec", "=", "null", ";", "m", "=", "d", ".", "getModel", "(", ")", ";", "if", "(", "m", "!=", "null", ")", "{", "try", "{", "vec", "=", "m", ".", "getInputVector", "(", ")", ";", "}", "catch", "(", "DAVEException", "ex", ")", "{", "Logger", ".", "getLogger", "(", "InputTableJFrame", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "vec", "=", "null", ";", "}", "}", "if", "(", "vec", "==", "null", ")", "{", "System", ".", "exit", "(", "0", ")", ";", "}", "array", "=", "new", "ArrayList", "<", "InputInfo", ">", "(", "vec", ".", "size", "(", ")", ")", ";", "ListIterator", "it", "=", "vec", ".", "listIterator", "(", ")", ";", "int", "index", "=", "0", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "signal", "=", "(", "VectorInfo", ")", "it", ".", "next", "(", ")", ";", "array", ".", "add", "(", "new", "InputInfo", "(", "signal", ")", ")", ";", "}", "if", "(", "d", ".", "hasCheckcases", "(", ")", ")", "{", "setMaxMinToInf", "(", ")", ";", "CheckData", "cd", "=", "d", ".", "getCheckcaseData", "(", ")", ";", "ArrayList", "<", "StaticShot", ">", "ssArray", "=", "cd", ".", "getStaticShots", "(", ")", ";", "Iterator", "ssIt", "=", "ssArray", ".", "iterator", "(", ")", ";", "while", "(", "ssIt", ".", "hasNext", "(", ")", ")", "{", "StaticShot", "ss", "=", "(", "StaticShot", ")", "ssIt", ".", "next", "(", ")", ";", "VectorInfoArrayList", "ssInputVectorInfo", "=", "ss", ".", "getInputs", "(", ")", ";", "Iterator", "inputIt", "=", "ssInputVectorInfo", ".", "iterator", "(", ")", ";", "while", "(", "inputIt", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "ccSignal", "=", "(", "VectorInfo", ")", "inputIt", ".", "next", "(", ")", ";", "String", "inputName", "=", "ccSignal", ".", "getName", "(", ")", ";", "double", "inputValue", "=", "ccSignal", ".", "getValue", "(", ")", ";", "boolean", "matched", "=", "false", ";", "Iterator", "sigIt", "=", "array", ".", "iterator", "(", ")", ";", "modelInput", "=", "null", ";", "while", "(", "sigIt", ".", "hasNext", "(", ")", ")", "{", "modelInput", "=", "(", "InputInfo", ")", "sigIt", ".", "next", "(", ")", ";", "if", "(", "modelInput", ".", "getName", "(", ")", "==", "null", "?", "inputName", "==", "null", ":", "modelInput", ".", "getName", "(", ")", ".", "equals", "(", "inputName", ")", ")", "{", "matched", "=", "true", ";", "break", ";", "}", "}", "if", "(", "matched", ")", "{", "modelInput", ".", "setMinMax", "(", "inputValue", ")", ";", "}", "}", "}", "Iterator", "sigIt", "=", "array", ".", "iterator", "(", ")", ";", "while", "(", "sigIt", ".", "hasNext", "(", ")", ")", "{", "modelInput", "=", "(", "InputInfo", ")", "sigIt", ".", "next", "(", ")", ";", "modelInput", ".", "setNominal", "(", ")", ";", "}", "}", "}", "private", "void", "setMaxMinToInf", "(", ")", "{", "Iterator", "it", "=", "array", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "InputInfo", "input", "=", "(", "InputInfo", ")", "it", ".", "next", "(", ")", ";", "input", ".", "setMax", "(", "Double", ".", "NEGATIVE_INFINITY", ")", ";", "input", ".", "setMin", "(", "Double", ".", "POSITIVE_INFINITY", ")", ";", "}", "}", "public", "double", "getMinVal", "(", "int", "offset", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "return", "input", ".", "getMin", "(", ")", ";", "}", "public", "double", "getMaxVal", "(", "int", "offset", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "return", "input", ".", "getMax", "(", ")", ";", "}", "public", "double", "getNomVal", "(", "int", "offset", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "return", "input", ".", "getNominal", "(", ")", ";", "}", "public", "void", "setMinVal", "(", "int", "offset", ",", "double", "minVal", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "input", ".", "setMin", "(", "minVal", ")", ";", "}", "public", "void", "setMaxVal", "(", "int", "offset", ",", "double", "maxVal", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "input", ".", "setMax", "(", "maxVal", ")", ";", "}", "public", "void", "setNomVal", "(", "int", "offset", ",", "double", "nomVal", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "input", ".", "setNominal", "(", "nomVal", ")", ";", "}", "public", "void", "loadNominalValues", "(", "VectorInfoArrayList", "inputVec", ")", "{", "Iterator", "it", "=", "inputVec", ".", "iterator", "(", ")", ";", "int", "i", "=", "0", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "VectorInfo", "vi", "=", "(", "VectorInfo", ")", "it", ".", "next", "(", ")", ";", "vi", ".", "setValue", "(", "this", ".", "getNomVal", "(", "i", ")", ")", ";", "i", "++", ";", "}", "}", "public", "String", "getName", "(", "int", "offset", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "return", "input", ".", "getName", "(", ")", ";", "}", "public", "String", "getUnits", "(", "int", "offset", ")", "{", "InputInfo", "input", "=", "array", ".", "get", "(", "offset", ")", ";", "return", "input", ".", "getUnits", "(", ")", ";", "}", "public", "int", "getRowCount", "(", ")", "{", "return", "array", ".", "size", "(", ")", ";", "}", "public", "int", "getColumnCount", "(", ")", "{", "return", "5", ";", "}", "@", "Override", "public", "boolean", "isCellEditable", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "if", "(", "columnIndex", ">", "1", ")", "return", "true", ";", "return", "false", ";", "}", "public", "Object", "getValueAt", "(", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "String", "answer", "=", "\"\"", ";", "switch", "(", "columnIndex", ")", "{", "case", "0", ":", "answer", "=", "getName", "(", "rowIndex", ")", ";", "break", ";", "case", "1", ":", "answer", "=", "getUnits", "(", "rowIndex", ")", ";", "break", ";", "case", "2", ":", "answer", "=", "new", "Double", "(", "getNomVal", "(", "rowIndex", ")", ")", ".", "toString", "(", ")", ";", "break", ";", "case", "3", ":", "answer", "=", "new", "Double", "(", "getMinVal", "(", "rowIndex", ")", ")", ".", "toString", "(", ")", ";", "break", ";", "case", "4", ":", "answer", "=", "new", "Double", "(", "getMaxVal", "(", "rowIndex", ")", ")", ".", "toString", "(", ")", ";", "break", ";", "}", "return", "answer", ";", "}", "@", "Override", "public", "String", "getColumnName", "(", "int", "columnIndex", ")", "{", "String", "answer", "=", "\"\"", ";", "switch", "(", "columnIndex", ")", "{", "case", "0", ":", "answer", "=", "\"Signal", "Name\"", ";", "break", ";", "case", "1", ":", "answer", "=", "\"Units\"", ";", "break", ";", "case", "2", ":", "answer", "=", "\"\"", ";", "break", ";", "case", "3", ":", "answer", "=", "\"\"", ";", "break", ";", "case", "4", ":", "answer", "=", "\"\"", ";", "break", ";", "}", "return", "answer", ";", "}", "@", "Override", "public", "void", "setValueAt", "(", "Object", "aValue", ",", "int", "rowIndex", ",", "int", "columnIndex", ")", "{", "double", "val", "=", "Double", ".", "parseDouble", "(", "(", "String", ")", "aValue", ")", ";", "switch", "(", "columnIndex", ")", "{", "case", "2", ":", "setNomVal", "(", "rowIndex", ",", "val", ")", ";", "break", ";", "case", "3", ":", "setMinVal", "(", "rowIndex", ",", "val", ")", ";", "break", ";", "case", "4", ":", "setMaxVal", "(", "rowIndex", ",", "val", ")", ";", "break", ";", "}", "uiClass", ".", "updateInputInfo", "(", "rowIndex", ")", ";", "}", "void", "setJFrame", "(", "InputTableJFrame", "inputTableJFrame", ")", "{", "parentJFrame", "=", "inputTableJFrame", ";", "parentJFrame", ".", "setModelName", "(", "m", ".", "getName", "(", ")", ")", ";", "}", "}", "</s>" ]
8,485
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "bookmark", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "AppClient", ".", "PearlClient", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ".", "PopupControl", ".", "PopupUIs", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "Window", ".", "Navigator", ";", "public", "class", "BookmarkState", "{", "private", "static", "UserTrees", "userTrees", ";", "private", "static", "final", "String", "HAS_RUN_FIRST_TIME_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "HAS_AUTH_FIRST_TIME_KEY", "=", "\"\"", ";", "static", "void", "init", "(", ")", "{", "WebContent", ".", "bookmarklet", "=", "true", ";", "WebContent", ".", "cookieEnabled", "=", "Navigator", ".", "isCookieEnabled", "(", ")", ";", "WebContent", ".", "onIpad", "=", "Navigator", ".", "getUserAgent", "(", ")", ".", "indexOf", "(", "\"iPad\"", ")", "!=", "-", "1", ";", "exports", "(", ")", ";", "userTrees", "=", "UserTrees", ".", "init", "(", ")", ";", "UserTrees", ".", "refreshTrees", "(", "false", ")", ";", "checkFirstRun", "(", ")", ";", "}", "static", "void", "setUserTrees", "(", "JavaScriptObject", "jsut", ")", "{", "UserTrees", "ut", "=", "new", "UserTrees", "(", "jsut", ")", ";", "boolean", "hasChanged", "=", "userTrees", ".", "hasChanged", "(", "ut", ")", ";", "userTrees", "=", "ut", ";", "if", "(", "hasChanged", "||", "UserTrees", ".", "getInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "if", "(", "userTrees", ".", "getStatus", "(", ")", "==", "UserTrees", ".", "LOADED", ")", "{", "onPopupRefresh", "(", "true", ")", ";", "}", "PopupControl", ".", "onUserTreesChanged", "(", ")", ";", "}", "}", "static", "void", "resizeScrollablePanel", "(", ")", "{", "PopupControl", ".", "onResize", "(", ")", ";", "}", "static", "JavaScriptObject", "getUserTreesData", "(", ")", "{", "return", "userTrees", ".", "getData", "(", ")", ";", "}", "private", "static", "native", "String", "getUserTreesString", "(", ")", ";", "static", "void", "reveal", "(", "String", "treeId", ",", "String", "assoId", ",", "int", "tabId", ",", "String", "url", ")", "{", "String", "hash", "=", "AppClient", ".", "buildRevealHash", "(", "userTrees", ",", "treeId", ",", "assoId", ")", ";", "if", "(", "WebContent", ".", "isInPearltrees", "(", "url", ")", ")", "{", "if", "(", "hash", "!=", "null", ")", "{", "navigateTo", "(", "WebContent", ".", "getUnanchoredUrl", "(", "url", ")", "+", "'#'", "+", "hash", ")", ";", "}", "return", ";", "}", "navigateTo", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", "+", "(", "hash", "==", "null", "?", "\"\"", ":", "'#'", "+", "hash", ")", ")", ";", "}", "static", "void", "goToAccountSync", "(", "int", "tabId", ",", "String", "url", ")", "{", "if", "(", "WebContent", ".", "isInPearltrees", "(", "url", ")", ")", "{", "navigateTo", "(", "WebContent", ".", "getUnanchoredUrl", "(", "url", ")", "+", "\"\"", ")", ";", "return", ";", "}", "navigateTo", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", "+", "\"\"", ")", ";", "}", "private", "static", "native", "void", "navigateTo", "(", "String", "toUrl", ")", ";", "private", "static", "void", "openCreateAccount", "(", ")", "{", "navigateTo", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", ")", ";", "}", "static", "void", "pearlContent", "(", "int", "tab", ",", "String", "url", ",", "String", "title", ",", "final", "String", "treeId", ",", "String", "parentTreeId", ",", "String", "newTreeName", ")", "{", "AppClient", ".", "pearlContent", "(", "url", ",", "title", ",", "treeId", ",", "parentTreeId", ",", "newTreeName", ",", "new", "PearlClient", "(", ")", "{", "@", "Override", "public", "boolean", "resetRevealed", "(", ")", "{", "return", "false", ";", "}", "@", "Override", "public", "void", "onError", "(", "String", "msg", ")", "{", "Alerts", ".", "alert", "(", "msg", ")", ";", "if", "(", "WebContent", ".", "onIpad", ")", "{", "Alerts", ".", "closeWindow", "(", ")", ";", "}", "}", "@", "Override", "public", "void", "onPearled", "(", "String", "newTreeId", ")", "{", "if", "(", "newTreeId", "!=", "null", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "TreeCreated", ")", ";", "}", "else", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "Pearled", ")", ";", "}", "}", "}", ")", ";", "}", "public", "static", "void", "onPopupRefresh", "(", "boolean", "login", ")", "{", "if", "(", "UserTrees", ".", "getInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "if", "(", "login", ")", "{", "UserTrees", ".", "setInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ",", "\"1\"", ")", ";", "return", ";", "}", "}", "}", "public", "static", "void", "checkFirstRun", "(", ")", "{", "if", "(", "UserTrees", ".", "getInLocalStorage", "(", "HAS_RUN_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "UserTrees", ".", "setInLocalStorage", "(", "HAS_RUN_FIRST_TIME_KEY", ",", "\"1\"", ")", ";", "}", "}", "static", "void", "onCredentials", "(", "String", "c", ")", "{", "if", "(", "c", ".", "equals", "(", "PopupElements", ".", "credentials", ")", ")", "{", "return", ";", "}", "PopupElements", ".", "credentials", "=", "c", ";", "PopupControl", ".", "onUserTreesChanged", "(", ")", ";", "}", "private", "static", "native", "void", "exports", "(", ")", ";", "}", "</s>" ]
8,486
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "bookmark", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "public", "class", "BookmarkMain", "implements", "EntryPoint", "{", "@", "Override", "public", "void", "onModuleLoad", "(", ")", "{", "BookmarkState", ".", "init", "(", ")", ";", "PopupControl", ".", "onModuleLoad", "(", ")", ";", "}", "}", "</s>" ]
8,487
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "import", "com", ".", "google", ".", "gwt", ".", "http", ".", "client", ".", "*", ";", "public", "class", "AppClient", "{", "public", "static", "interface", "PearlClient", "{", "boolean", "resetRevealed", "(", ")", ";", "void", "onError", "(", "String", "msg", ")", ";", "void", "onPearled", "(", "String", "newTreeId", ")", ";", "}", "public", "static", "void", "pearlContent", "(", "String", "url", ",", "String", "title", ",", "String", "treeId", ",", "String", "parentTreeId", ",", "String", "newTreeName", ",", "final", "PearlClient", "client", ")", "{", "String", "service", "=", "WebContent", ".", "getCollectorUrl", "(", ")", "+", "\"add\"", ";", "url", "=", "url", ".", "replace", "(", "\"", "\"", ",", "\"%20\"", ")", ";", "String", "requestData", "=", "\"url=\"", "+", "URL", ".", "encodeComponent", "(", "url", ")", "+", "\"&title=\"", "+", "URL", ".", "encodeComponent", "(", "title", ")", ";", "if", "(", "treeId", "!=", "null", ")", "{", "requestData", "+=", "\"&treeID=\"", "+", "treeId", ";", "}", "else", "{", "requestData", "+=", "\"\"", ";", "requestData", "+=", "\"\"", "+", "URL", ".", "encodeComponent", "(", "newTreeName", ")", ";", "requestData", "+=", "\"\"", "+", "parentTreeId", ";", "}", "if", "(", "client", ".", "resetRevealed", "(", ")", ")", "{", "requestData", "+=", "\"&dup=1\"", ";", "}", "RequestBuilder", "builder", "=", "new", "RequestBuilder", "(", "RequestBuilder", ".", "POST", ",", "service", ")", ";", "builder", ".", "setHeader", "(", "\"Content-type\"", ",", "\"\"", ")", ";", "try", "{", "builder", ".", "sendRequest", "(", "requestData", ",", "new", "RequestCallback", "(", ")", "{", "@", "Override", "public", "void", "onError", "(", "Request", "request", ",", "Throwable", "exception", ")", "{", "client", ".", "onError", "(", "Alerts", ".", "getUserMessage", "(", "exception", ")", ")", ";", "}", "@", "Override", "public", "void", "onResponseReceived", "(", "Request", "request", ",", "Response", "response", ")", "{", "if", "(", "response", ".", "getStatusCode", "(", ")", "==", "Response", ".", "SC_OK", ")", "{", "if", "(", "\"0\"", ".", "equals", "(", "response", ".", "getText", "(", ")", ")", ")", "{", "client", ".", "onPearled", "(", "null", ")", ";", "}", "else", "if", "(", "\"2\"", ".", "equals", "(", "response", ".", "getText", "(", ")", ")", ")", "{", "client", ".", "onError", "(", "\"\"", ")", ";", "}", "else", "if", "(", "\"3\"", ".", "equals", "(", "response", ".", "getText", "(", ")", ")", ")", "{", "client", ".", "onError", "(", "\"\"", ")", ";", "}", "else", "if", "(", "\"4\"", ".", "equals", "(", "response", ".", "getText", "(", ")", ")", ")", "{", "client", ".", "onError", "(", "\"\"", ")", ";", "}", "else", "if", "(", "response", ".", "getText", "(", ")", ".", "startsWith", "(", "\"0,\"", ")", ")", "{", "client", ".", "onPearled", "(", "response", ".", "getText", "(", ")", ".", "substring", "(", "2", ")", ")", ";", "}", "else", "{", "client", ".", "onError", "(", "Alerts", ".", "getUserMessageForInvalid", "(", ")", ")", ";", "}", "}", "else", "{", "client", ".", "onError", "(", "Alerts", ".", "getUserMessage", "(", "response", ".", "getStatusCode", "(", ")", ")", ")", ";", "}", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "client", ".", "onError", "(", "Alerts", ".", "getUserMessage", "(", "e", ")", ")", ";", "}", "}", "public", "static", "String", "buildRevealHash", "(", "UserTrees", "userTrees", ",", "String", "treeId", ",", "String", "assoId", ")", "{", "if", "(", "userTrees", ".", "getTreeId", "(", "UserTrees", ".", "DROPZONE_INDEX", ")", ".", "equals", "(", "treeId", ")", ")", "{", "return", "null", ";", "}", "String", "hash", "=", "\"/N-reveal=1\"", ";", "hash", "+=", "\"&N-u=1_\"", "+", "userTrees", ".", "getUserId", "(", ")", ";", "hash", "+=", "\"&N-s=1_\"", "+", "treeId", ";", "hash", "+=", "\"&N-f=1_\"", "+", "treeId", ";", "if", "(", "!", "assoId", ".", "isEmpty", "(", ")", ")", "{", "hash", "+=", "\"&N-fa=\"", "+", "assoId", ";", "}", "return", "hash", ";", "}", "}", "</s>" ]
8,488
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "import", "com", ".", "google", ".", "gwt", ".", "event", ".", "dom", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "event", ".", "shared", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "ui", ".", "*", ";", "public", "class", "TreeListItem", "extends", "FlowPanel", "implements", "InsertPanel", "{", "public", "HandlerRegistration", "addClickHandler", "(", "ClickHandler", "handler", ")", "{", "return", "addDomHandler", "(", "handler", ",", "ClickEvent", ".", "getType", "(", ")", ")", ";", "}", "}", "</s>" ]
8,489
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "public", "class", "WebContent", "{", "public", "static", "boolean", "bookmarklet", ";", "public", "static", "boolean", "onIpad", ";", "public", "static", "boolean", "cookieEnabled", ";", "public", "enum", "PearltreesState", "{", "Normal", ",", "Tunnel", ",", "GetStarted", ",", "Settings", ",", "BookmarkletTunnel", "}", "public", "static", "boolean", "isInPearltrees", "(", "String", "url", ")", "{", "return", "url", "!=", "null", "&&", "url", ".", "startsWith", "(", "getPearltreesUrl", "(", ")", ")", ";", "}", "public", "static", "PearltreesState", "getPearltreesState", "(", "String", "url", ")", "{", "if", "(", "!", "isInPearltrees", "(", "url", ")", ")", "{", "return", "null", ";", "}", "if", "(", "url", ".", "indexOf", "(", "\"\"", ")", ">=", "0", ")", "{", "return", "PearltreesState", ".", "BookmarkletTunnel", ";", "}", "int", "anchor", "=", "getAnchorStart", "(", "url", ")", ";", "if", "(", "anchor", "<", "0", ")", "{", "return", "null", ";", "}", "if", "(", "url", ".", "indexOf", "(", "\"\"", ",", "anchor", ")", ">=", "0", ")", "{", "return", "PearltreesState", ".", "Settings", ";", "}", "if", "(", "url", ".", "indexOf", "(", "\"DP-n=tunnel\"", ",", "anchor", ")", ">=", "0", ")", "{", "return", "PearltreesState", ".", "Tunnel", ";", "}", "if", "(", "url", ".", "indexOf", "(", "\"\"", ",", "anchor", ")", ">=", "0", ")", "{", "return", "PearltreesState", ".", "GetStarted", ";", "}", "return", "null", ";", "}", "public", "static", "String", "getUnanchoredUrl", "(", "String", "url", ")", "{", "int", "anchor", "=", "getAnchorStart", "(", "url", ")", ";", "return", "anchor", "<", "0", "?", "url", ":", "url", ".", "substring", "(", "0", ",", "anchor", ")", ";", "}", "public", "static", "String", "getCurrentTree", "(", "String", "ptUrl", ")", "{", "int", "anchor", "=", "getAnchorStart", "(", "ptUrl", ")", ";", "String", "param", "=", "parseAnchorParam", "(", "ptUrl", ",", "anchor", ",", "\"N-s=1_\"", ")", ";", "if", "(", "param", "!=", "null", ")", "{", "return", "param", ";", "}", "return", "parseAnchorParam", "(", "ptUrl", ",", "anchor", ",", "\"N-f=1_\"", ")", ";", "}", "private", "static", "String", "parseAnchorParam", "(", "String", "ptUrl", ",", "int", "anchor", ",", "String", "start", ")", "{", "if", "(", "anchor", "<", "0", ")", "{", "return", "null", ";", "}", "int", "i", "=", "ptUrl", ".", "indexOf", "(", "start", ",", "anchor", ")", ";", "if", "(", "i", "<", "0", ")", "{", "return", "null", ";", "}", "i", "+=", "start", ".", "length", "(", ")", ";", "int", "pos", "=", "i", ";", "for", "(", ";", "i", "<", "ptUrl", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "c", "=", "ptUrl", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", "<", "'0'", "||", "c", ">", "'9'", ")", "{", "break", ";", "}", "}", "return", "pos", "==", "i", "?", "null", ":", "ptUrl", ".", "substring", "(", "pos", ",", "i", ")", ";", "}", "private", "static", "int", "getAnchorStart", "(", "String", "url", ")", "{", "return", "url", ".", "indexOf", "(", "'#'", ")", ";", "}", "public", "static", "boolean", "isWebUrl", "(", "String", "url", ")", "{", "return", "url", "!=", "null", "&&", "(", "url", ".", "startsWith", "(", "\"http://\"", ")", "||", "url", ".", "startsWith", "(", "\"https://\"", ")", ")", ";", "}", "public", "static", "native", "void", "openInNewTab", "(", "String", "href", ")", ";", "public", "static", "native", "String", "getPearltreesUrl", "(", ")", ";", "public", "static", "native", "String", "getCDNLocations", "(", ")", ";", "public", "static", "native", "String", "getCollectorUrl", "(", ")", ";", "private", "static", "native", "void", "navigateTo", "(", "int", "tabId", ",", "String", "toUrl", ")", ";", "}", "</s>" ]
8,490
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "import", "java", ".", "util", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "http", ".", "client", ".", "*", ";", "public", "class", "UserTrees", "{", "public", "static", "final", "int", "NOT_LOADED", "=", "0", ";", "public", "static", "final", "int", "LOADED", "=", "1", ";", "public", "static", "final", "int", "LOGOUT", "=", "2", ";", "public", "static", "final", "int", "ERROR", "=", "3", ";", "public", "static", "final", "int", "DROPZONE_INDEX", "=", "0", ";", "public", "static", "final", "int", "ROOTTREE_INDEX", "=", "1", ";", "private", "static", "final", "int", "MAX_PEARLS", "=", "100", ";", "private", "static", "final", "String", "USER_TREE_STORED", "=", "\"\"", ";", "private", "final", "JavaScriptObject", "data", ";", "public", "UserTrees", "(", "JavaScriptObject", "d", ")", "{", "data", "=", "d", ";", "}", "public", "JavaScriptObject", "getData", "(", ")", "{", "return", "data", ";", "}", "public", "int", "getStatus", "(", ")", "{", "return", "getStatus", "(", "data", ")", ";", "}", "public", "String", "getMessage", "(", ")", "{", "return", "getMessage", "(", "data", ")", ";", "}", "private", "static", "native", "int", "getStatus", "(", "JavaScriptObject", "data", ")", ";", "private", "static", "native", "String", "getMessage", "(", "JavaScriptObject", "data", ")", ";", "public", "String", "getUserId", "(", ")", "{", "return", "getUserId", "(", "data", ")", ";", "}", "private", "static", "native", "String", "getUserId", "(", "JavaScriptObject", "data", ")", ";", "public", "int", "getTreeCount", "(", ")", "{", "return", "getTreeCount", "(", "data", ")", ";", "}", "private", "static", "native", "int", "getTreeCount", "(", "JavaScriptObject", "data", ")", ";", "private", "static", "native", "JavaScriptObject", "getTree", "(", "JavaScriptObject", "data", ",", "int", "i", ")", ";", "public", "String", "getTreeId", "(", "int", "i", ")", "{", "return", "getTreeId", "(", "getTree", "(", "data", ",", "i", ")", ")", ";", "}", "private", "static", "native", "String", "getTreeId", "(", "JavaScriptObject", "tree", ")", ";", "public", "String", "getTreeTitle", "(", "int", "i", ")", "{", "return", "getTreeTitle", "(", "getTree", "(", "data", ",", "i", ")", ")", ";", "}", "private", "static", "native", "String", "getTreeTitle", "(", "JavaScriptObject", "tree", ")", ";", "public", "String", "getTreeAssoId", "(", "int", "i", ")", "{", "return", "getTreeAssoId", "(", "getTree", "(", "data", ",", "i", ")", ")", ";", "}", "private", "static", "native", "String", "getTreeAssoId", "(", "JavaScriptObject", "tree", ")", ";", "public", "String", "getTreeAvatarHash", "(", "int", "i", ")", "{", "return", "getTreeAvatarHash", "(", "getTree", "(", "data", ",", "i", ")", ")", ";", "}", "private", "static", "native", "String", "getTreeAvatarHash", "(", "JavaScriptObject", "tree", ")", ";", "public", "boolean", "isTeam", "(", "int", "i", ")", "{", "JavaScriptObject", "tree", "=", "getTree", "(", "data", ",", "i", ")", ";", "return", "getTreeAssoId", "(", "tree", ")", ".", "equals", "(", "getTreeId", "(", "tree", ")", ")", ";", "}", "public", "int", "getTreeDepth", "(", "int", "i", ")", "{", "return", "Integer", ".", "parseInt", "(", "getTreeDepth", "(", "getTree", "(", "data", ",", "i", ")", ")", ")", ";", "}", "private", "static", "native", "String", "getTreeDepth", "(", "JavaScriptObject", "tree", ")", ";", "public", "int", "getTreeCollapsed", "(", "int", "i", ")", "{", "String", "collapsedTree", "=", "getTreeCollapsed", "(", "getTree", "(", "data", ",", "i", ")", ")", ";", "if", "(", "collapsedTree", "!=", "null", "&&", "!", "collapsedTree", ".", "equals", "(", "\"\"", ")", ")", "{", "return", "Integer", ".", "parseInt", "(", "collapsedTree", ")", ";", "}", "return", "0", ";", "}", "private", "static", "native", "String", "getTreeCollapsed", "(", "JavaScriptObject", "tree", ")", ";", "public", "void", "setTreeCollapsed", "(", "int", "i", ",", "int", "collapsed", ")", "{", "setTreeCollapsed", "(", "getTree", "(", "data", ",", "i", ")", ",", "collapsed", ")", ";", "}", "private", "static", "native", "void", "setTreeCollapsed", "(", "JavaScriptObject", "tree", ",", "int", "collapsed", ")", ";", "public", "boolean", "isTreeFull", "(", "int", "i", ")", "{", "return", "Integer", ".", "parseInt", "(", "getTreePearlCount", "(", "getTree", "(", "data", ",", "i", ")", ")", ")", ">=", "MAX_PEARLS", ";", "}", "private", "static", "native", "String", "getTreePearlCount", "(", "JavaScriptObject", "tree", ")", ";", "public", "static", "native", "void", "backgroundRefreshTrees", "(", "boolean", "force", ")", ";", "public", "static", "native", "JavaScriptObject", "getUserTreesData", "(", ")", ";", "UserTrees", "(", "JavaScriptObject", "d", ",", "int", "status", ",", "String", "msg", ")", "{", "data", "=", "d", "==", "null", "?", "makeData", "(", ")", ":", "d", ";", "setStatus", "(", "data", ",", "status", ",", "msg", ")", ";", "}", "private", "static", "native", "JavaScriptObject", "makeData", "(", ")", ";", "private", "static", "native", "void", "setStatus", "(", "JavaScriptObject", "data", ",", "int", "status", ",", "String", "msg", ")", ";", "private", "static", "native", "void", "exports", "(", ")", ";", "static", "boolean", "requestTreesRunning", "=", "false", ";", "static", "Date", "lastRequestTreesReceived", "=", "new", "Date", "(", "0", ")", ";", "public", "static", "UserTrees", "init", "(", ")", "{", "UserTrees", "ut", ";", "String", "textStored", "=", "getInLocalStorage", "(", "USER_TREE_STORED", ")", ";", "exports", "(", ")", ";", "if", "(", "textStored", "!=", "null", "&&", "!", "\"\"", ".", "equals", "(", "textStored", ")", ")", "{", "ut", "=", "new", "UserTrees", "(", "parseJson", "(", "textStored", ")", ",", "LOADED", ",", "\"Loaded\"", ")", ";", "return", "ut", ";", "}", "ut", "=", "new", "UserTrees", "(", "null", ",", "NOT_LOADED", ",", "\"Not", "loaded\"", ")", ";", "return", "ut", ";", "}", "public", "static", "void", "refreshTrees", "(", "boolean", "force", ")", "{", "if", "(", "requestTreesRunning", ")", "{", "return", ";", "}", "if", "(", "!", "force", "&&", "new", "Date", "(", ")", ".", "getTime", "(", ")", "-", "lastRequestTreesReceived", ".", "getTime", "(", ")", "<", "3000", ")", "{", "return", ";", "}", "requestTrees", "(", ")", ";", "}", "private", "static", "void", "requestTrees", "(", ")", "{", "requestTreesRunning", "=", "true", ";", "String", "service", "=", "WebContent", ".", "getCollectorUrl", "(", ")", "+", "\"\"", ";", "RequestBuilder", "builder", "=", "new", "RequestBuilder", "(", "RequestBuilder", ".", "GET", ",", "service", ")", ";", "try", "{", "builder", ".", "sendRequest", "(", "null", ",", "new", "RequestCallback", "(", ")", "{", "@", "Override", "public", "void", "onError", "(", "Request", "request", ",", "Throwable", "exception", ")", "{", "requestTreesRunning", "=", "false", ";", "UserTrees", "ut", "=", "new", "UserTrees", "(", "null", ",", "ERROR", ",", "Alerts", ".", "getUserMessage", "(", "exception", ")", ")", ";", "lastRequestTreesReceived", "=", "new", "Date", "(", ")", ";", "setUserTrees", "(", "ut", ".", "getData", "(", ")", ")", ";", "}", "@", "Override", "public", "void", "onResponseReceived", "(", "Request", "request", ",", "Response", "response", ")", "{", "requestTreesRunning", "=", "false", ";", "setUserTrees", "(", "onTreesReceived", "(", "response", ".", "getStatusCode", "(", ")", ",", "response", ".", "getText", "(", ")", ")", ".", "getData", "(", ")", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "requestTreesRunning", "=", "false", ";", "UserTrees", "ut", "=", "new", "UserTrees", "(", "null", ",", "ERROR", ",", "Alerts", ".", "getUserMessage", "(", "e", ")", ")", ";", "setUserTrees", "(", "ut", ".", "getData", "(", ")", ")", ";", "}", "}", "public", "static", "UserTrees", "onTreesReceived", "(", "int", "statusCode", ",", "String", "text", ")", "{", "UserTrees", "ut", ";", "if", "(", "statusCode", "==", "Response", ".", "SC_OK", ")", "{", "if", "(", "text", ".", "startsWith", "(", "\"{\\\"treeList\\\":\"", ")", "&&", "text", ".", "endsWith", "(", "\"}}\"", ")", ")", "{", "ut", "=", "new", "UserTrees", "(", "parseJson", "(", "text", ")", ",", "LOADED", ",", "\"Loaded\"", ")", ";", "setInLocalStorage", "(", "USER_TREE_STORED", ",", "text", ")", ";", "if", "(", "ut", ".", "getTreeCount", "(", ")", "<", "2", ")", "{", "ut", "=", "new", "UserTrees", "(", "null", ",", "ERROR", ",", "Alerts", ".", "getUserMessageForMalformed", "(", ")", ")", ";", "}", "}", "else", "{", "ut", "=", "new", "UserTrees", "(", "null", ",", "ERROR", ",", "Alerts", ".", "getUserMessageForInvalid", "(", ")", ")", ";", "}", "}", "else", "if", "(", "statusCode", "==", "Response", ".", "SC_SEE_OTHER", ")", "{", "ut", "=", "new", "UserTrees", "(", "null", ",", "LOGOUT", ",", "Alerts", ".", "getUserMessage", "(", "statusCode", ")", ")", ";", "}", "else", "{", "ut", "=", "new", "UserTrees", "(", "null", ",", "ERROR", ",", "Alerts", ".", "getUserMessage", "(", "statusCode", ")", ")", ";", "}", "lastRequestTreesReceived", "=", "new", "Date", "(", ")", ";", "return", "ut", ";", "}", "public", "void", "updateTreeCollapsed", "(", "ArrayList", "<", "Integer", ">", "treesToClose", ",", "ArrayList", "<", "Integer", ">", "treesToOpen", ")", "{", "String", "service", "=", "WebContent", ".", "getCollectorUrl", "(", ")", "+", "\"\"", ";", "String", "requestData", "=", "\"{'data':[\"", ";", "for", "(", "int", "index", ":", "treesToClose", ")", "{", "setTreeCollapsed", "(", "index", ",", "1", ")", ";", "requestData", "+=", "\"{'treeID':\"", "+", "getTreeId", "(", "index", ")", "+", "\"\"", ";", "}", "for", "(", "int", "index", ":", "treesToOpen", ")", "{", "setTreeCollapsed", "(", "index", ",", "0", ")", ";", "requestData", "+=", "\"{'treeID':\"", "+", "getTreeId", "(", "index", ")", "+", "\"\"", ";", "}", "requestData", "=", "requestData", ".", "substring", "(", "0", ",", "requestData", ".", "length", "(", ")", "-", "1", ")", ";", "requestData", "+=", "\"]}\"", ";", "RequestBuilder", "builder", "=", "new", "RequestBuilder", "(", "RequestBuilder", ".", "POST", ",", "service", ")", ";", "try", "{", "builder", ".", "sendRequest", "(", "requestData", ",", "new", "RequestCallback", "(", ")", "{", "@", "Override", "public", "void", "onResponseReceived", "(", "Request", "request", ",", "Response", "response", ")", "{", "setInLocalStorage", "(", "USER_TREE_STORED", ",", "stringify", "(", "getData", "(", ")", ")", ")", ";", "}", "@", "Override", "public", "void", "onError", "(", "Request", "request", ",", "Throwable", "exception", ")", "{", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}", "static", "native", "String", "stringify", "(", "JavaScriptObject", "jsut", ")", ";", "static", "native", "void", "setUserTrees", "(", "JavaScriptObject", "jsut", ")", ";", "static", "native", "JavaScriptObject", "parseJson", "(", "String", "json", ")", ";", "public", "static", "native", "String", "getInLocalStorage", "(", "String", "key", ")", ";", "public", "static", "native", "void", "setInLocalStorage", "(", "String", "key", ",", "String", "value", ")", ";", "public", "boolean", "hasChanged", "(", "UserTrees", "n", ")", "{", "if", "(", "getStatus", "(", ")", "!=", "n", ".", "getStatus", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "getMessage", "(", ")", ".", "equals", "(", "n", ".", "getMessage", "(", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "getStatus", "(", ")", "!=", "LOADED", ")", "{", "return", "false", ";", "}", "int", "i", "=", "getTreeCount", "(", ")", ";", "if", "(", "i", "!=", "n", ".", "getTreeCount", "(", ")", ")", "{", "return", "true", ";", "}", "for", "(", ";", "i", "--", ">", "0", ";", ")", "{", "if", "(", "!", "getTreeId", "(", "i", ")", ".", "equals", "(", "n", ".", "getTreeId", "(", "i", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "getTreeAssoId", "(", "i", ")", ".", "equals", "(", "n", ".", "getTreeAssoId", "(", "i", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "!", "getTreeTitle", "(", "i", ")", ".", "equals", "(", "n", ".", "getTreeTitle", "(", "i", ")", ")", ")", "{", "return", "true", ";", "}", "if", "(", "getTreeDepth", "(", "i", ")", "!=", "n", ".", "getTreeDepth", "(", "i", ")", ")", "{", "return", "true", ";", "}", "if", "(", "isTreeFull", "(", "i", ")", "!=", "n", ".", "isTreeFull", "(", "i", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}", "}", "</s>" ]
8,491
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "import", "java", ".", "util", ".", "*", ";", "public", "class", "TreeNode", "{", "private", "TreeListItem", "treeListItem", ";", "private", "TreeNode", "parent", ";", "private", "ArrayList", "<", "TreeNode", ">", "children", ";", "public", "TreeNode", "(", "TreeNode", "parent", ")", "{", "super", "(", ")", ";", "this", ".", "parent", "=", "parent", ";", "}", "public", "TreeListItem", "getTreeListItem", "(", ")", "{", "return", "treeListItem", ";", "}", "public", "void", "setTreeListItem", "(", "TreeListItem", "treeListItem", ")", "{", "this", ".", "treeListItem", "=", "treeListItem", ";", "}", "public", "TreeNode", "getParent", "(", ")", "{", "return", "parent", ";", "}", "public", "void", "setParent", "(", "TreeNode", "parent", ")", "{", "this", ".", "parent", "=", "parent", ";", "}", "public", "ArrayList", "<", "TreeNode", ">", "getChildren", "(", ")", "{", "return", "children", ";", "}", "public", "void", "addChild", "(", "TreeNode", "child", ")", "{", "if", "(", "children", "==", "null", ")", "{", "children", "=", "new", "ArrayList", "<", "TreeNode", ">", "(", ")", ";", "}", "children", ".", "add", "(", "child", ")", ";", "}", "}", "</s>" ]
8,492
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "http", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "*", ";", "public", "class", "Alerts", "{", "public", "static", "void", "alert", "(", "String", "arg", ")", "{", "Window", ".", "alert", "(", "arg", ")", ";", "}", "public", "static", "native", "void", "log", "(", "String", "arg", ")", ";", "public", "static", "native", "void", "closeWindow", "(", ")", ";", "public", "static", "native", "int", "getTabId", "(", "JavaScriptObject", "tab", ")", ";", "public", "static", "String", "getUserMessage", "(", "Throwable", "e", ")", "{", "return", "getUserMessage", "(", "0", ")", ";", "}", "public", "static", "String", "getUserMessage", "(", "int", "statusCode", ")", "{", "if", "(", "statusCode", "==", "Response", ".", "SC_SERVICE_UNAVAILABLE", ")", "{", "return", "\"\"", ";", "}", "if", "(", "statusCode", "==", "Response", ".", "SC_SEE_OTHER", ")", "{", "return", "\"\"", ";", "}", "return", "\"\"", ";", "}", "public", "static", "String", "getUserMessageForInvalid", "(", ")", "{", "return", "\"\"", ";", "}", "public", "static", "String", "getUserMessageForMalformed", "(", ")", "{", "return", "\"\"", ";", "}", "public", "static", "native", "void", "setButtonIcon", "(", "boolean", "forceGo", ",", "boolean", "startAnim", ")", ";", "public", "static", "String", "escapeHtml", "(", "String", "maybeHtml", ")", "{", "final", "Element", "div", "=", "DOM", ".", "createDiv", "(", ")", ";", "DOM", ".", "setInnerText", "(", "div", ",", "maybeHtml", ")", ";", "return", "DOM", ".", "getInnerHTML", "(", "div", ")", ";", "}", "}", "</s>" ]
8,493
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "background", ";", "import", "java", ".", "util", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "public", "class", "BrowserTab", "{", "private", "static", "final", "Map", "<", "Integer", ",", "BrowserTab", ">", "tabs", "=", "new", "LinkedHashMap", "<", "Integer", ",", "BrowserTab", ">", "(", ")", ";", "private", "int", "id", ";", "private", "Date", "creation", ";", "private", "String", "url", ";", "static", "void", "init", "(", ")", "{", "exports", "(", ")", ";", "}", "private", "static", "BrowserTab", "getById", "(", "Integer", "id", ")", "{", "BrowserTab", "t", "=", "tabs", ".", "get", "(", "id", ")", ";", "if", "(", "t", "==", "null", ")", "{", "t", "=", "new", "BrowserTab", "(", ")", ";", "t", ".", "id", "=", "id", ";", "t", ".", "creation", "=", "new", "Date", "(", ")", ";", "tabs", ".", "put", "(", "id", ",", "t", ")", ";", "}", "return", "t", ";", "}", "static", "BrowserTab", "getPearltreesTab", "(", ")", "{", "for", "(", "BrowserTab", "t", ":", "tabs", ".", "values", "(", ")", ")", "{", "if", "(", "WebContent", ".", "isInPearltrees", "(", "t", ".", "getUrl", "(", ")", ")", ")", "{", "return", "t", ";", "}", "}", "return", "null", ";", "}", "int", "getId", "(", ")", "{", "return", "id", ";", "}", "String", "getUrl", "(", ")", "{", "return", "url", ";", "}", "static", "void", "onRemoved", "(", "int", "tabId", ")", "{", "tabs", ".", "remove", "(", "tabId", ")", ";", "}", "static", "void", "setCurrentTab", "(", "boolean", "isSelection", ",", "int", "tabId", ",", "String", "url", ",", "JavaScriptObject", "tab", ")", "{", "BrowserTab", "t", "=", "getById", "(", "tabId", ")", ";", "t", ".", "url", "=", "url", ";", "AppState", ".", "isWebUrl", "=", "WebContent", ".", "isWebUrl", "(", "url", ")", ";", "AppState", ".", "isInPearltrees", "=", "AppState", ".", "isWebUrl", "&&", "WebContent", ".", "isInPearltrees", "(", "url", ")", ";", "MainButton", ".", "setIcon", "(", "false", ",", "false", ")", ";", "if", "(", "isSelection", "&&", "AppState", ".", "isInPearltrees", "&&", "AppState", ".", "getSelectedTree", "(", ")", "!=", "null", "&&", "AppState", ".", "lastPearled", "!=", "null", "&&", "t", ".", "creation", ".", "before", "(", "AppState", ".", "lastPearled", ")", ")", "{", "AppState", ".", "reveal", "(", "AppState", ".", "getSelectedTree", "(", ")", ",", "AppState", ".", "getSelectedAsso", "(", ")", ",", "tabId", ",", "url", ")", ";", "}", "else", "if", "(", "AppState", ".", "isInPearltrees", ")", "{", "String", "tree", "=", "WebContent", ".", "getCurrentTree", "(", "url", ")", ";", "if", "(", "tree", "!=", "null", ")", "{", "AppState", ".", "setSelectedTree", "(", "tree", ",", "\"\"", ")", ";", "}", "}", "}", "private", "static", "native", "void", "exports", "(", ")", ";", "}", "</s>" ]
8,494
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "background", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "public", "class", "BackgroundMain", "implements", "EntryPoint", "{", "@", "Override", "public", "void", "onModuleLoad", "(", ")", "{", "AppState", ".", "init", "(", ")", ";", "}", "}", "</s>" ]
8,495
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "background", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "*", ";", "public", "class", "MainButton", "{", "private", "static", "boolean", "go", "=", "false", ";", "private", "static", "int", "animPhase", "=", "0", ";", "private", "static", "String", "currentIcon", "=", "null", ";", "static", "void", "init", "(", ")", "{", "exports", "(", ")", ";", "}", "static", "void", "nextPhase", "(", ")", "{", "animPhase", "++", ";", "switch", "(", "animPhase", ")", "{", "case", "1", ":", "case", "7", ":", "setIcon", "(", "\"pearl-2\"", ")", ";", "break", ";", "case", "2", ":", "case", "6", ":", "setIcon", "(", "\"pearl-3\"", ")", ";", "break", ";", "case", "3", ":", "case", "5", ":", "setIcon", "(", "\"pearl-4\"", ")", ";", "break", ";", "case", "4", ":", "setIcon", "(", "\"pearl-5\"", ")", ";", "break", ";", "default", ":", "animPhase", "=", "0", ";", "}", "if", "(", "animPhase", "==", "0", ")", "{", "setIcon", "(", "go", ",", "false", ")", ";", "}", "else", "{", "Timer", "t", "=", "new", "Timer", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "nextPhase", "(", ")", ";", "}", "}", ";", "t", ".", "schedule", "(", "200", ")", ";", "}", "}", "static", "void", "setIcon", "(", "boolean", "forceGo", ",", "boolean", "startAnim", ")", "{", "go", "=", "forceGo", ";", "if", "(", "animPhase", "==", "0", ")", "{", "if", "(", "startAnim", ")", "{", "nextPhase", "(", ")", ";", "}", "else", "{", "setIcon", "(", "forceGo", "||", "!", "AppState", ".", "isPearlable", "(", ")", "?", "\"go\"", ":", "\"in\"", ")", ";", "}", "}", "}", "private", "static", "void", "setIcon", "(", "String", "name", ")", "{", "if", "(", "!", "name", ".", "equals", "(", "currentIcon", ")", ")", "{", "setBrowserActionIcon", "(", "\"\"", "+", "name", "+", "\".png\"", ")", ";", "currentIcon", "=", "name", ";", "}", "}", "private", "static", "native", "void", "setBrowserActionIcon", "(", "String", "iconPath", ")", ";", "private", "static", "native", "void", "exports", "(", ")", ";", "}", "</s>" ]
8,496
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "background", ";", "import", "java", ".", "util", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "AppClient", ".", "PearlClient", ";", "import", "com", ".", "google", ".", "gwt", ".", "core", ".", "client", ".", "*", ";", "public", "class", "AppState", "{", "private", "static", "final", "String", "HAS_RUN_FIRST_TIME_KEY", "=", "\"\"", ";", "private", "static", "final", "String", "HAS_AUTH_FIRST_TIME_KEY", "=", "\"\"", ";", "private", "static", "UserTrees", "userTrees", ";", "static", "Date", "lastPearled", "=", "null", ";", "static", "boolean", "hasRevealed", "=", "false", ";", "private", "static", "String", "selectedTree", "=", "null", ";", "private", "static", "String", "selectedAsso", "=", "null", ";", "static", "boolean", "isWebUrl", ";", "static", "boolean", "isInPearltrees", ";", "static", "void", "init", "(", ")", "{", "exports", "(", ")", ";", "BrowserTab", ".", "init", "(", ")", ";", "MainButton", ".", "init", "(", ")", ";", "userTrees", "=", "UserTrees", ".", "init", "(", ")", ";", "UserTrees", ".", "refreshTrees", "(", "false", ")", ";", "checkFirstRun", "(", ")", ";", "}", "static", "void", "setUserTrees", "(", "JavaScriptObject", "jsut", ")", "{", "UserTrees", "ut", "=", "new", "UserTrees", "(", "jsut", ")", ";", "boolean", "hasChanged", "=", "userTrees", ".", "hasChanged", "(", "ut", ")", ";", "userTrees", "=", "ut", ";", "if", "(", "hasChanged", "||", "getInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "if", "(", "userTrees", ".", "getStatus", "(", ")", "==", "UserTrees", ".", "LOADED", ")", "{", "onPopupRefresh", "(", "true", ")", ";", "}", "onUserTreesChanged", "(", ")", ";", "}", "}", "private", "static", "native", "void", "onUserTreesChanged", "(", ")", ";", "static", "JavaScriptObject", "getUserTreesData", "(", ")", "{", "return", "userTrees", ".", "getData", "(", ")", ";", "}", "static", "String", "getSelectedTree", "(", ")", "{", "return", "selectedTree", ";", "}", "static", "String", "getSelectedAsso", "(", ")", "{", "return", "selectedAsso", ";", "}", "static", "void", "setSelectedTree", "(", "String", "id", ",", "String", "assoId", ")", "{", "selectedTree", "=", "id", ";", "selectedAsso", "=", "assoId", ";", "}", "static", "void", "openInNewTab", "(", "String", "href", ")", "{", "hasRevealed", "|=", "WebContent", ".", "isInPearltrees", "(", "href", ")", ";", "createTab", "(", "href", ")", ";", "}", "static", "void", "reveal", "(", "String", "treeId", ",", "String", "assoId", ",", "int", "tabId", ",", "String", "url", ")", "{", "hasRevealed", "=", "true", ";", "lastPearled", "=", "null", ";", "String", "hash", "=", "AppClient", ".", "buildRevealHash", "(", "userTrees", ",", "treeId", ",", "assoId", ")", ";", "if", "(", "WebContent", ".", "isInPearltrees", "(", "url", ")", ")", "{", "if", "(", "hash", "!=", "null", ")", "{", "navigateTo", "(", "tabId", ",", "WebContent", ".", "getUnanchoredUrl", "(", "url", ")", "+", "'#'", "+", "hash", ")", ";", "}", "return", ";", "}", "BrowserTab", "t", "=", "BrowserTab", ".", "getPearltreesTab", "(", ")", ";", "if", "(", "t", "==", "null", ")", "{", "createTab", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", "+", "(", "hash", "==", "null", "?", "\"\"", ":", "'#'", "+", "hash", ")", ")", ";", "return", ";", "}", "navigateTo", "(", "t", ".", "getId", "(", ")", ",", "hash", "==", "null", "?", "null", ":", "WebContent", ".", "getUnanchoredUrl", "(", "t", ".", "getUrl", "(", ")", ")", "+", "'#'", "+", "hash", ")", ";", "}", "static", "void", "goToAccountSync", "(", "int", "tabId", ",", "String", "url", ")", "{", "if", "(", "WebContent", ".", "isInPearltrees", "(", "url", ")", ")", "{", "navigateTo", "(", "tabId", ",", "WebContent", ".", "getUnanchoredUrl", "(", "url", ")", "+", "\"\"", ")", ";", "return", ";", "}", "BrowserTab", "t", "=", "BrowserTab", ".", "getPearltreesTab", "(", ")", ";", "if", "(", "t", "==", "null", ")", "{", "createTab", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", "+", "\"\"", ")", ";", "return", ";", "}", "navigateTo", "(", "t", ".", "getId", "(", ")", ",", "WebContent", ".", "getUnanchoredUrl", "(", "t", ".", "getUrl", "(", ")", ")", "+", "\"\"", ")", ";", "}", "private", "static", "native", "void", "navigateTo", "(", "int", "tabId", ",", "String", "toUrl", ")", ";", "private", "static", "native", "void", "createTab", "(", "String", "toUrl", ")", ";", "static", "void", "pearlContent", "(", "int", "tab", ",", "String", "url", ",", "String", "title", ",", "String", "treeId", ",", "String", "parentTreeId", ",", "String", "newTreeName", ")", "{", "lastPearled", "=", "new", "Date", "(", ")", ";", "AppClient", ".", "pearlContent", "(", "url", ",", "title", ",", "treeId", ",", "parentTreeId", ",", "newTreeName", ",", "new", "PearlClient", "(", ")", "{", "@", "Override", "public", "boolean", "resetRevealed", "(", ")", "{", "if", "(", "hasRevealed", ")", "{", "hasRevealed", "=", "false", ";", "return", "true", ";", "}", "return", "false", ";", "}", "@", "Override", "public", "void", "onError", "(", "String", "msg", ")", "{", "Alerts", ".", "alert", "(", "msg", ")", ";", "}", "@", "Override", "public", "void", "onPearled", "(", "String", "newTreeId", ")", "{", "if", "(", "newTreeId", "!=", "null", ")", "{", "setSelectedTree", "(", "newTreeId", ",", "\"\"", ")", ";", "UserTrees", ".", "refreshTrees", "(", "true", ")", ";", "}", "}", "}", ")", ";", "}", "static", "boolean", "isPearlable", "(", ")", "{", "return", "isWebUrl", "&&", "!", "isInPearltrees", ";", "}", "private", "static", "native", "String", "getInLocalStorage", "(", "String", "key", ")", ";", "private", "static", "native", "void", "setInLocalStorage", "(", "String", "key", ",", "String", "value", ")", ";", "static", "void", "onPopupRefresh", "(", "boolean", "login", ")", "{", "if", "(", "getInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "if", "(", "login", ")", "{", "setInLocalStorage", "(", "HAS_AUTH_FIRST_TIME_KEY", ",", "\"1\"", ")", ";", "return", ";", "}", "}", "}", "private", "static", "void", "checkFirstRun", "(", ")", "{", "if", "(", "getInLocalStorage", "(", "HAS_RUN_FIRST_TIME_KEY", ")", "==", "null", ")", "{", "setInLocalStorage", "(", "HAS_RUN_FIRST_TIME_KEY", ",", "\"1\"", ")", ";", "openCreateAccount", "(", ")", ";", "}", "}", "private", "static", "void", "openCreateAccount", "(", ")", "{", "AppState", ".", "createTab", "(", "WebContent", ".", "getPearltreesUrl", "(", ")", "+", "\"\"", ")", ";", "}", "private", "static", "native", "void", "exports", "(", ")", ";", "}", "</s>" ]
8,497
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ";", "import", "java", ".", "util", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "WebContent", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "event", ".", "logical", ".", "shared", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "ui", ".", "*", ";", "public", "class", "PopupControl", "{", "private", "static", "UserTrees", "userTrees", ";", "public", "static", "boolean", "panelScrollableExist", ";", "public", "static", "int", "height", ";", "public", "static", "int", "width", ";", "private", "static", "PopupUIs", "currentUI", "=", "PopupUIs", ".", "Loading", ";", "public", "static", "enum", "PopupUIs", "{", "Error", ",", "Loading", ",", "Login", ",", "LoginFailed", ",", "LoginSuccessfull", ",", "InTunnel", ",", "InSettings", ",", "InBookmarkletTunnel", ",", "TreeList", ",", "NewTree", ",", "ChooseParent", ",", "Pearled", ",", "PearledDirectly", ",", "TreeCreated", ",", "BackToList", "}", "public", "static", "void", "newScroll", "(", "String", "id", ")", "{", "setNewScroll", "(", "id", ")", ";", "}", "public", "static", "void", "refreshScroll", "(", ")", "{", "refresh", "(", ")", ";", "}", "public", "static", "void", "onModuleLoad", "(", ")", "{", "Window", ".", "addCloseHandler", "(", "new", "CloseHandler", "<", "Window", ">", "(", ")", "{", "@", "Override", "public", "void", "onClose", "(", "CloseEvent", "<", "Window", ">", "event", ")", "{", "Alerts", ".", "setButtonIcon", "(", "false", ",", "false", ")", ";", "}", "}", ")", ";", "exports", "(", ")", ";", "userTrees", "=", "new", "UserTrees", "(", "UserTrees", ".", "getUserTreesData", "(", ")", ")", ";", "UserTrees", ".", "backgroundRefreshTrees", "(", "true", ")", ";", "if", "(", "!", "WebContent", ".", "onIpad", ")", "{", "retrieveSize", "(", ")", ";", "}", "else", "{", "retrieveSizeForIpad", "(", ")", ";", "}", "if", "(", "WebContent", ".", "bookmarklet", ")", "{", "getFirstDetails", "(", ")", ";", "PearltreesState", "s", "=", "WebContent", ".", "getPearltreesState", "(", "TreeListUI", ".", "currentUrl", ")", ";", "if", "(", "s", "==", "PearltreesState", ".", "Settings", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "InSettings", ")", ";", "return", ";", "}", "else", "if", "(", "s", "==", "PearltreesState", ".", "Tunnel", "||", "s", "==", "PearltreesState", ".", "GetStarted", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "InTunnel", ")", ";", "return", ";", "}", "else", "if", "(", "s", "==", "PearltreesState", ".", "BookmarkletTunnel", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "InBookmarkletTunnel", ")", ";", "return", ";", "}", "}", "makeUI", "(", "false", ")", ";", "}", "public", "static", "void", "changeUI", "(", "PopupUIs", "ui", ")", "{", "changeUI", "(", "ui", ",", "false", ")", ";", "}", "public", "static", "void", "changeUI", "(", "PopupUIs", "ui", ",", "boolean", "dueToTreesChange", ")", "{", "cleanUI", "(", ")", ";", "currentUI", "=", "ui", ";", "makeUI", "(", "dueToTreesChange", ")", ";", "}", "private", "static", "void", "cleanUI", "(", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "clear", "(", ")", ";", "}", "public", "static", "void", "onResize", "(", ")", "{", "boolean", "noGoBackBar", "=", "(", "TreeListUI", ".", "chooseParent", "||", "TreeListUI", ".", "goDirectly", ")", ";", "resize", "(", "noGoBackBar", ",", "PopupControl", ".", "panelScrollableExist", ")", ";", "}", "private", "static", "void", "makeUI", "(", "boolean", "dueToTreesChange", ")", "{", "if", "(", "currentUI", "==", "PopupUIs", ".", "InTunnel", "||", "currentUI", "==", "PopupUIs", ".", "InSettings", "||", "currentUI", "==", "PopupUIs", ".", "InBookmarkletTunnel", ")", "{", "InactiveUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "currentUI", ")", ";", "return", ";", "}", "if", "(", "currentUI", "==", "PopupUIs", ".", "Pearled", "&&", "TreeListUI", ".", "PearledDirect", ")", "{", "PearledUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "false", ",", "TreeListUI", ".", "isPearlable", ")", ";", "return", ";", "}", "switch", "(", "userTrees", ".", "getStatus", "(", ")", ")", "{", "case", "UserTrees", ".", "NOT_LOADED", ":", "currentUI", "=", "PopupUIs", ".", "Loading", ";", "if", "(", "WebContent", ".", "onIpad", ")", "{", "LoadingUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "break", ";", "case", "UserTrees", ".", "LOADED", ":", "onPopupRefresh", "(", "true", ")", ";", "switch", "(", "currentUI", ")", "{", "case", "NewTree", ":", "NewTreeUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ")", ";", "break", ";", "case", "TreeCreated", ":", "if", "(", "WebContent", ".", "bookmarklet", ")", "{", "PearledUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "true", ",", "TreeListUI", ".", "isPearlable", ")", ";", "}", "else", "{", "TreeCreatedUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ")", ";", "}", "break", ";", "case", "Pearled", ":", "PearledUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "false", ",", "TreeListUI", ".", "isPearlable", ")", ";", "break", ";", "case", "ChooseParent", ":", "TreeListUI", ".", "chooseParent", "=", "true", ";", "TreeListUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "break", ";", "default", ":", "TreeListUI", ".", "chooseParent", "=", "false", ";", "currentUI", "=", "PopupUIs", ".", "TreeList", ";", "TreeListUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "break", ";", "case", "UserTrees", ".", "LOGOUT", ":", "if", "(", "dueToTreesChange", ")", "{", "onPopupRefresh", "(", "false", ")", ";", "}", "if", "(", "currentUI", "==", "PopupUIs", ".", "LoginFailed", ")", "{", "LoginFailedUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ")", ";", "}", "else", "if", "(", "currentUI", "==", "PopupUIs", ".", "LoginSuccessfull", "&&", "WebContent", ".", "onIpad", ")", "{", "LoadingUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "else", "{", "if", "(", "!", "WebContent", ".", "cookieEnabled", "&&", "WebContent", ".", "onIpad", ")", "{", "currentUI", "=", "PopupUIs", ".", "Error", ";", "ErrorUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "else", "{", "currentUI", "=", "PopupUIs", ".", "Login", ";", "LoginUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "}", "break", ";", "default", ":", "currentUI", "=", "PopupUIs", ".", "Error", ";", "ErrorUI", ".", "init", "(", "RootPanel", ".", "get", "(", ")", ",", "userTrees", ")", ";", "}", "}", "public", "static", "void", "onUserTreesChanged", "(", ")", "{", "userTrees", "=", "new", "UserTrees", "(", "UserTrees", ".", "getUserTreesData", "(", ")", ")", ";", "if", "(", "userTrees", ".", "getStatus", "(", ")", "==", "UserTrees", ".", "LOADED", ")", "{", "switch", "(", "currentUI", ")", "{", "case", "NewTree", ":", "case", "TreeCreated", ":", "case", "Pearled", ":", "case", "InTunnel", ":", "case", "InSettings", ":", "return", ";", "case", "TreeList", ":", "case", "ChooseParent", ":", "if", "(", "TreeListUI", ".", "isClosing", ")", "{", "return", ";", "}", "break", ";", "}", "}", "changeUI", "(", "currentUI", ",", "true", ")", ";", "}", "static", "void", "onViewCreated", "(", ")", "{", "Iterator", "<", "Widget", ">", "it", "=", "RootPanel", ".", "get", "(", ")", ".", "iterator", "(", ")", ";", "if", "(", "it", ".", "hasNext", "(", ")", ")", "{", "it", ".", "next", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "it", ".", "next", "(", ")", ";", "it", ".", "remove", "(", ")", ";", "}", "}", "Alerts", ".", "setButtonIcon", "(", "currentUI", "==", "PopupUIs", ".", "TreeList", "&&", "TreeListUI", ".", "isGoMode", "(", ")", ",", "false", ")", ";", "}", "public", "static", "void", "onFirstDetails", "(", "String", "url", ",", "String", "title", ")", "{", "TreeListUI", ".", "currentUrl", "=", "url", ";", "TreeListUI", ".", "currentTitle", "=", "title", ";", "}", "public", "static", "native", "void", "getFirstDetails", "(", ")", ";", "static", "void", "onSize", "(", "int", "h", ",", "int", "w", ")", "{", "if", "(", "!", "WebContent", ".", "onIpad", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "setHeight", "(", "h", "+", "\"px\"", ")", ";", "if", "(", "WebContent", ".", "bookmarklet", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "setWidth", "(", "\"100%\"", ")", ";", "}", "else", "{", "RootPanel", ".", "get", "(", ")", ".", "setWidth", "(", "w", "+", "\"px\"", ")", ";", "}", "height", "=", "h", ";", "width", "=", "w", ";", "}", "}", "public", "static", "native", "void", "setNewScroll", "(", "String", "id", ")", ";", "private", "static", "native", "void", "refresh", "(", ")", ";", "private", "static", "native", "void", "onPopupRefresh", "(", "boolean", "login", ")", ";", "private", "static", "native", "void", "retrieveSize", "(", ")", ";", "public", "static", "native", "void", "resize", "(", "boolean", "noGoBackBar", ",", "boolean", "panelScrollableExist", ")", ";", "private", "static", "native", "void", "retrieveSizeForIpad", "(", ")", ";", "private", "static", "native", "void", "exports", "(", ")", ";", "}", "</s>" ]
8,498
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ".", "PopupControl", ".", "PopupUIs", ";", "import", "com", ".", "google", ".", "gwt", ".", "event", ".", "dom", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "http", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "ui", ".", "*", ";", "public", "class", "LoginUI", "{", "private", "static", "boolean", "frozen", ";", "private", "static", "String", "fieldUser", "=", "\"\"", ";", "private", "static", "String", "fieldPass", "=", "\"\"", ";", "static", "void", "init", "(", "Panel", "parent", ",", "UserTrees", "userTrees", ")", "{", "frozen", "=", "false", ";", "FlowPanel", "panel", "=", "new", "FlowPanel", "(", ")", ";", "parent", ".", "add", "(", "panel", ")", ";", "PopupElements", ".", "createCredentials", "(", "panel", ",", "userTrees", ")", ";", "FlowPanel", "line", "=", "new", "FlowPanel", "(", ")", ";", "panel", ".", "add", "(", "line", ")", ";", "Label", "userLbl", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "userLbl", ".", "setText", "(", "\"username\"", ")", ";", "userLbl", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_PADDING", ")", ";", "userLbl", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LOGIN", ")", ";", "FlowPanel", "userPanel", "=", "new", "FlowPanel", "(", ")", ";", "userPanel", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_INPUT", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "userPanel", ",", "15", ")", ";", "Label", "passLbl", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "passLbl", ".", "setText", "(", "\"password\"", ")", ";", "passLbl", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_PADDING", ")", ";", "passLbl", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LOGIN", ")", ";", "FlowPanel", "passPanel", "=", "new", "FlowPanel", "(", ")", ";", "passPanel", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_INPUT", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "passPanel", ",", "15", ")", ";", "FlowPanel", "buttons", "=", "new", "FlowPanel", "(", ")", ";", "final", "TextBox", "userBox", "=", "PopupElements", ".", "createTextBox", "(", ")", ";", "userPanel", ".", "add", "(", "userBox", ")", ";", "userBox", ".", "setMaxLength", "(", "64", ")", ";", "userBox", ".", "setText", "(", "fieldUser", ")", ";", "userBox", ".", "setFocus", "(", "true", ")", ";", "final", "PasswordTextBox", "passBox", "=", "PopupElements", ".", "createPasswordTextBox", "(", ")", ";", "passPanel", ".", "add", "(", "passBox", ")", ";", "passBox", ".", "setMaxLength", "(", "500", ")", ";", "passBox", ".", "setText", "(", "fieldPass", ")", ";", "passBox", ".", "setTabIndex", "(", "1", ")", ";", "if", "(", "!", "WebContent", ".", "onIpad", ")", "{", "line", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_TEXT", ")", ";", "line", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_PADDING", ")", ";", "InlineLabel", "l1", "=", "PopupElements", ".", "createInlineLabel", "(", ")", ";", "line", ".", "add", "(", "l1", ")", ";", "l1", ".", "setText", "(", "\"\"", ")", ";", "l1", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_BOLD", ")", ";", "InlineLabel", "create", "=", "PopupElements", ".", "createInlineLabel", "(", ")", ";", "line", ".", "add", "(", "create", ")", ";", "create", ".", "setText", "(", "\"Click", "here\"", ")", ";", "create", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LINK", ")", ";", "create", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "LoginFailedUI", ".", "goCreate", "(", ")", ";", "}", "}", ")", ";", "InlineLabel", "l2", "=", "PopupElements", ".", "createInlineLabel", "(", ")", ";", "line", ".", "add", "(", "l2", ")", ";", "l2", ".", "setText", "(", "\"\"", ")", ";", "l2", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_BOLD", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "line", ",", "40", ")", ";", "Label", "login", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "panel", ".", "add", "(", "login", ")", ";", "login", ".", "setText", "(", "\"\"", ")", ";", "login", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_BOLD", ")", ";", "login", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_PADDING", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "login", ",", "10", ")", ";", "panel", ".", "add", "(", "userLbl", ")", ";", "panel", ".", "add", "(", "userPanel", ")", ";", "panel", ".", "add", "(", "passLbl", ")", ";", "panel", ".", "add", "(", "passPanel", ")", ";", "panel", ".", "add", "(", "buttons", ")", ";", "Label", "ok", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "buttons", ".", "add", "(", "ok", ")", ";", "ok", ".", "setText", "(", "\"ok\"", ")", ";", "ok", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LINKBLACK", ")", ";", "ok", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_RIGHT", ")", ";", "ok", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "onValidate", "(", "userBox", ".", "getText", "(", ")", ",", "passBox", ".", "getText", "(", ")", ")", ";", "}", "}", ")", ";", "}", "else", "{", "PopupElements", ".", "createDescription", "(", "panel", ",", "line", ",", "false", ",", "\"\"", ",", "false", ")", ";", "userBox", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LOGIN", ")", ";", "passBox", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LOGIN", ")", ";", "FlowPanel", "wrapp", "=", "new", "FlowPanel", "(", ")", ";", "panel", ".", "add", "(", "wrapp", ")", ";", "wrapp", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_LOGIN_IPAD", ")", ";", "wrapp", ".", "add", "(", "userLbl", ")", ";", "wrapp", ".", "add", "(", "userPanel", ")", ";", "wrapp", ".", "add", "(", "passLbl", ")", ";", "wrapp", ".", "add", "(", "passPanel", ")", ";", "HTML", "ok", "=", "PopupElements", ".", "createHtml", "(", ")", ";", "ok", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_NEWTREE_BUTTONS_IPAD", ")", ";", "ok", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LOGIN", ")", ";", "ok", ".", "setHTML", "(", "PopupElements", ".", "OK", ")", ";", "wrapp", ".", "add", "(", "ok", ")", ";", "ok", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "onValidate", "(", "userBox", ".", "getText", "(", ")", ",", "passBox", ".", "getText", "(", ")", ")", ";", "}", "}", ")", ";", "}", "userBox", ".", "addKeyDownHandler", "(", "new", "KeyDownHandler", "(", ")", "{", "@", "Override", "public", "void", "onKeyDown", "(", "KeyDownEvent", "event", ")", "{", "if", "(", "event", ".", "getNativeKeyCode", "(", ")", "==", "13", "||", "event", ".", "getNativeKeyCode", "(", ")", "==", "9", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "passBox", ".", "setFocus", "(", "true", ")", ";", "}", "}", "}", ")", ";", "passBox", ".", "addKeyDownHandler", "(", "new", "KeyDownHandler", "(", ")", "{", "@", "Override", "public", "void", "onKeyDown", "(", "KeyDownEvent", "event", ")", "{", "if", "(", "event", ".", "getNativeKeyCode", "(", ")", "==", "13", ")", "{", "onValidate", "(", "userBox", ".", "getText", "(", ")", ",", "passBox", ".", "getText", "(", ")", ")", ";", "}", "else", "if", "(", "event", ".", "getNativeKeyCode", "(", ")", "==", "9", "&&", "event", ".", "isShiftKeyDown", "(", ")", ")", "{", "event", ".", "preventDefault", "(", ")", ";", "userBox", ".", "setFocus", "(", "true", ")", ";", "}", "}", "}", ")", ";", "PopupControl", ".", "onViewCreated", "(", ")", ";", "}", "static", "void", "onValidate", "(", "String", "user", ",", "String", "pass", ")", "{", "if", "(", "frozen", ")", "{", "return", ";", "}", "if", "(", "user", ".", "isEmpty", "(", ")", "||", "pass", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "fieldUser", "=", "user", ";", "fieldPass", "=", "pass", ";", "frozen", "=", "true", ";", "sendLogin", "(", "fieldUser", ",", "fieldPass", ")", ";", "}", "static", "void", "loginError", "(", "String", "msg", ")", "{", "failedLogin", "(", ")", ";", "}", "static", "void", "successfulLogin", "(", ")", "{", "if", "(", "WebContent", ".", "onIpad", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "LoginSuccessfull", ")", ";", "PopupControl", ".", "onModuleLoad", "(", ")", ";", "}", "else", "{", "UserTrees", ".", "backgroundRefreshTrees", "(", "true", ")", ";", "}", "}", "static", "void", "failedLogin", "(", ")", "{", "PopupControl", ".", "changeUI", "(", "PopupUIs", ".", "LoginFailed", ")", ";", "}", "static", "void", "sendLogin", "(", "String", "fieldUser", ",", "String", "fieldPass", ")", "{", "String", "service", "=", "WebContent", ".", "getCollectorUrl", "(", ")", "+", "\"loguser\"", ";", "String", "requestData", "=", "\"username=\"", "+", "URL", ".", "encodeComponent", "(", "fieldUser", ")", "+", "\"&password=\"", "+", "URL", ".", "encodeComponent", "(", "fieldPass", ")", ";", "RequestBuilder", "builder", "=", "new", "RequestBuilder", "(", "RequestBuilder", ".", "POST", ",", "service", ")", ";", "builder", ".", "setHeader", "(", "\"Content-type\"", ",", "\"\"", ")", ";", "try", "{", "builder", ".", "sendRequest", "(", "requestData", ",", "new", "RequestCallback", "(", ")", "{", "@", "Override", "public", "void", "onError", "(", "Request", "request", ",", "Throwable", "exception", ")", "{", "loginError", "(", "Alerts", ".", "getUserMessage", "(", "exception", ")", ")", ";", "}", "@", "Override", "public", "void", "onResponseReceived", "(", "Request", "request", ",", "Response", "response", ")", "{", "if", "(", "response", ".", "getStatusCode", "(", ")", "==", "Response", ".", "SC_OK", ")", "{", "if", "(", "response", ".", "getText", "(", ")", ".", "equals", "(", "\"0\"", ")", ")", "{", "successfulLogin", "(", ")", ";", "}", "else", "if", "(", "response", ".", "getText", "(", ")", ".", "equals", "(", "\"1\"", ")", ")", "{", "failedLogin", "(", ")", ";", "}", "else", "{", "loginError", "(", "Alerts", ".", "getUserMessageForMalformed", "(", ")", ")", ";", "}", "}", "else", "{", "loginError", "(", "Alerts", ".", "getUserMessage", "(", "response", ".", "getStatusCode", "(", ")", ")", ")", ";", "}", "}", "}", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "loginError", "(", "Alerts", ".", "getUserMessage", "(", "e", ")", ")", ";", "}", "}", "}", "</s>" ]
8,499
[ "<s>", "package", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "popup", ";", "import", "com", ".", "broceliand", ".", "pearlbar", ".", "chrome", ".", "client", ".", "common", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "event", ".", "dom", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "*", ";", "import", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "ui", ".", "*", ";", "public", "class", "ErrorUI", "{", "static", "void", "init", "(", "Panel", "parent", ",", "UserTrees", "userTrees", ")", "{", "if", "(", "!", "WebContent", ".", "onIpad", ")", "{", "FlowPanel", "panel", "=", "new", "FlowPanel", "(", ")", ";", "FocusPanel", "focus", "=", "new", "FocusPanel", "(", "panel", ")", ";", "parent", ".", "add", "(", "focus", ")", ";", "focus", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_FOCUS", ")", ";", "focus", ".", "setFocus", "(", "true", ")", ";", "Label", "title", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "panel", ".", "add", "(", "title", ")", ";", "title", ".", "setText", "(", "\"Error\"", ")", ";", "title", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_BLUEBOLD", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "title", ",", "20", ")", ";", "Label", "message", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "panel", ".", "add", "(", "message", ")", ";", "message", ".", "setText", "(", "userTrees", ".", "getMessage", "(", ")", ")", ";", "message", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_ERROR", ")", ";", "PopupElements", ".", "setMarginBottom", "(", "message", ",", "20", ")", ";", "FlowPanel", "buttons", "=", "new", "FlowPanel", "(", ")", ";", "panel", ".", "add", "(", "buttons", ")", ";", "Label", "ok", "=", "PopupElements", ".", "createLabel", "(", ")", ";", "buttons", ".", "add", "(", "ok", ")", ";", "ok", ".", "setText", "(", "\"ok\"", ")", ";", "ok", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_LINK", ")", ";", "ok", ".", "addStyleDependentName", "(", "PopupElements", ".", "STYLE_RIGHT", ")", ";", "focus", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "Alerts", ".", "closeWindow", "(", ")", ";", "}", "}", ")", ";", "focus", ".", "addKeyPressHandler", "(", "new", "KeyPressHandler", "(", ")", "{", "@", "Override", "public", "void", "onKeyPress", "(", "KeyPressEvent", "event", ")", "{", "Alerts", ".", "closeWindow", "(", ")", ";", "}", "}", ")", ";", "focus", ".", "addBlurHandler", "(", "new", "BlurHandler", "(", ")", "{", "@", "Override", "public", "void", "onBlur", "(", "BlurEvent", "event", ")", "{", "Alerts", ".", "closeWindow", "(", ")", ";", "}", "}", ")", ";", "}", "else", "{", "PopupControl", ".", "panelScrollableExist", "=", "false", ";", "parent", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_NONSCROLLABLE", ")", ";", "DOM", ".", "setElementAttribute", "(", "parent", ".", "getElement", "(", ")", ",", "\"id\"", ",", "\"\"", ")", ";", "FlowPanel", "description", "=", "new", "FlowPanel", "(", ")", ";", "PopupElements", ".", "createDescription", "(", "parent", ",", "description", ",", "false", ",", "userTrees", ".", "getMessage", "(", ")", ",", "false", ")", ";", "FlowPanel", "panelError", "=", "new", "FlowPanel", "(", ")", ";", "parent", ".", "add", "(", "panelError", ")", ";", "if", "(", "(", "\"\"", ")", ".", "equals", "(", "userTrees", ".", "getMessage", "(", ")", ")", ")", "{", "HTML", "errorBox", "=", "PopupElements", ".", "createHtml", "(", ")", ";", "errorBox", ".", "setStylePrimaryName", "(", "PopupElements", ".", "PRIMARY_STYLE_CENTERED", ")", ";", "errorBox", ".", "setHTML", "(", "PopupElements", ".", "COOKIES", ")", ";", "}", "FlowPanel", "scroller", "=", "new", "FlowPanel", "(", ")", ";", "panelError", ".", "add", "(", "scroller", ")", ";", "DOM", ".", "setElementAttribute", "(", "panelError", ".", "getElement", "(", ")", ",", "\"id\"", ",", "\"\"", ")", ";", "DOM", ".", "setElementAttribute", "(", "scroller", ".", "getElement", "(", ")", ",", "\"id\"", ",", "\"scroller\"", ")", ";", "PopupControl", ".", "onResize", "(", ")", ";", "PopupElements", ".", "createGoBackToApp", "(", "parent", ",", "true", ")", ";", "}", "PopupControl", ".", "onViewCreated", "(", ")", ";", "}", "}", "</s>" ]