Merge branch 'master' of git.skalarprodukt.de:chris/TrafficSim
This commit is contained in:
commit
d0f73c0670
@ -9,7 +9,7 @@ import java.util.concurrent.Semaphore;
|
||||
/**
|
||||
* Main model class of TrafficSim. Represents a round course containing vehicles.
|
||||
*/
|
||||
public class Track extends Observable {
|
||||
public class Track {
|
||||
/**
|
||||
* list a vehicles on the track
|
||||
*/
|
||||
|
@ -1,265 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
|
||||
<!--Created by yEd 3.18.2-->
|
||||
<key attr.name="Beschreibung" attr.type="string" for="graph" id="d0"/>
|
||||
<key for="port" id="d1" yfiles.type="portgraphics"/>
|
||||
<key for="port" id="d2" yfiles.type="portgeometry"/>
|
||||
<key for="port" id="d3" yfiles.type="portuserdata"/>
|
||||
<key attr.name="url" attr.type="string" for="node" id="d4"/>
|
||||
<key attr.name="description" attr.type="string" for="node" id="d5"/>
|
||||
<key for="node" id="d6" yfiles.type="nodegraphics"/>
|
||||
<key for="graphml" id="d7" yfiles.type="resources"/>
|
||||
<key attr.name="url" attr.type="string" for="edge" id="d8"/>
|
||||
<key attr.name="description" attr.type="string" for="edge" id="d9"/>
|
||||
<key for="edge" id="d10" yfiles.type="edgegraphics"/>
|
||||
<graph edgedefault="directed" id="G">
|
||||
<data key="d0" xml:space="preserve"/>
|
||||
<node id="n0">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="261.74881661991583" width="454.94982322346914" x="203.37046005726967" y="216.7983870967741"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="49.525390625" x="202.71221629923457" xml:space="preserve" y="3.0">Vehicle<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"># position: float
|
||||
# curVelocity: float
|
||||
# maxVelocity: float
|
||||
# brakeProb: float
|
||||
# id: int
|
||||
# test: int
|
||||
# trackLength: float</y:AttributeLabel>
|
||||
<y:MethodLabel xml:space="preserve">+ timeElapse(): void
|
||||
- getPosition(): float
|
||||
- getCurVelocity(): float
|
||||
- getMaxVelocity(): float
|
||||
- updateVelocity(distanceForerunner: float): void
|
||||
- timeElapse(): void
|
||||
|
||||
- Vehicle(id: id, position: int, maxVelocity: float, brakeProb: float, trackLength: float)</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n1">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="239.72392180925658" width="318.9863253856943" x="272.00000000000006" y="-73.49999999999989"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="38.68994140625" x="140.14819198972214" xml:space="preserve" y="3.0">Track<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"># vehicles: List<Vehicle>
|
||||
# vtrList: List<List<VehicleTimeRecord>>
|
||||
# trackLength: float
|
||||
# sumAvgMemory: float
|
||||
# lastAvg: float</y:AttributeLabel>
|
||||
<y:MethodLabel xml:space="preserve">+ timeElapse(timestep: float): void
|
||||
# createVehiclesList(numberVehicles: int): List<Vehicle>
|
||||
- getVtrList(): List<List<VehicleTimeRecord>>
|
||||
- getTrackLength(): float
|
||||
- avg_step(step: int): float
|
||||
# update_avg(): void
|
||||
|
||||
- Track(numberVehicles: int, trackLength: float)</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n2">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="185.25140252454426" width="407.8298854604958" x="338.5536684782608" y="515.6441795231414"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="124.65625" x="141.5868177302479" xml:space="preserve" y="3.0">VehicleTimeRecord<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"># id: int
|
||||
# position: float
|
||||
# velocity: float
|
||||
# maxVelocity: float</y:AttributeLabel>
|
||||
<y:MethodLabel xml:space="preserve">- getMaxVelocity(): float
|
||||
- getPosition(): float
|
||||
- getVelocity(): float
|
||||
|
||||
- VehicleTimeRecord(id: int, position: int, velocity: float, maxVelocity: float)</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n3">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="100.0" width="378.11827956989254" x="-347.7597373188404" y="31.442145862552735"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="108.75537109375" x="134.68145423807127" xml:space="preserve" y="3.0">TimeRecordView<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"/>
|
||||
<y:MethodLabel xml:space="preserve"># onSizeChanged(w: int, h: int, oldw: int, oldh: int): void
|
||||
|
||||
- TimeRecordView(context: context, track: Track)
|
||||
</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n4">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="28.0" width="100.0" x="-208.7005975338941" y="-160.9167031907433"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="81.314453125" x="9.3427734375" xml:space="preserve" y="3.0">SurfaveView<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"/>
|
||||
<y:MethodLabel xml:space="preserve"/>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n5">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="376.2424833450209" width="269.12833099579257" x="-417.2893072113136" y="243.66936579593266"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="80.57177734375" x="94.27827682602128" xml:space="preserve" y="3.0">MainActivity<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"> -static defaultNoOfVehicles: int = 25 {readOnly}
|
||||
- static defaultTrackLength: int = 100 {readOnly}
|
||||
- static defaultBrakeProb: float = 0.3f {readOnly}
|
||||
- static defaultMaxVelocity: float = 5.0f {readOnly}
|
||||
- static defaultDelay: int = 0 {readOnly}
|
||||
- static defaultHistoryLength: int = 50 {readOnly}
|
||||
- static defaultFrameskip: int = 0 {readOnly}
|
||||
# Track track: Track
|
||||
# TimeRecordView trackView: TimeRecordView
|
||||
# Worker worker: Worker
|
||||
# Renderer renderer: Renderer
|
||||
# LinearLayout viewStack: LinearLayout</y:AttributeLabel>
|
||||
<y:MethodLabel xml:space="preserve"># onCreate(savedInstanceState:Bundle): void
|
||||
- static round(float number, int digits): float
|
||||
# stopWorker(): void
|
||||
# updateTrack(): void
|
||||
- onProgressChanged(seekBar: SeekBar, progress: int, fromUser; boolean): void
|
||||
- onStartTrackingTouch(seekBar: SeekBar): void
|
||||
- onStopTrackingTouch(seekBar: SeekBar): void
|
||||
- onStepButtonClick(view: View): void
|
||||
- onPlayButtonClick(view: View): void
|
||||
- onStopButtonClick(view: View): void
|
||||
- onClearButtonClick(view: View): void</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n6">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="87.37727910238425" width="100.0" x="646.3835539387567" y="116.33785501402525"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="48.7890625" x="25.60546875" xml:space="preserve" y="3.0">Worker<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"># frameskip: int
|
||||
# renderer: Renderer
|
||||
# track: Track
|
||||
# stop: boolean
|
||||
# gui: MainActivity
|
||||
# Renderer renderer
|
||||
# int frameskip;</y:AttributeLabel>
|
||||
<y:MethodLabel xml:space="preserve">- run(): void
|
||||
- setStop(stop: boolean): void
|
||||
- setFrameskip(frames): int: void
|
||||
|
||||
- Worker(track: track, gui: MainActivity, renderer: Renderer, frameskip: int)
|
||||
</y:MethodLabel>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<node id="n7">
|
||||
<data key="d4" xml:space="preserve"/>
|
||||
<data key="d6">
|
||||
<y:UMLClassNode>
|
||||
<y:Geometry height="28.0" width="100.0" x="646.3835539387567" y="-73.49999999999989"/>
|
||||
<y:Fill color="#FFCC00" transparent="false"/>
|
||||
<y:BorderStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="13" fontStyle="bold" hasBackgroundColor="false" hasLineColor="false" height="19.92626953125" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="47.341796875" x="26.3291015625" xml:space="preserve" y="3.0">Thread<y:LabelModel><y:SmartNodeLabelModel distance="4.0"/></y:LabelModel><y:ModelParameter><y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/></y:ModelParameter></y:NodeLabel>
|
||||
<y:UML clipContent="true" constraint="" hasDetailsColor="false" omitDetails="false" stereotype="" use3DEffect="true">
|
||||
<y:AttributeLabel xml:space="preserve"/>
|
||||
<y:MethodLabel xml:space="preserve"/>
|
||||
</y:UML>
|
||||
</y:UMLClassNode>
|
||||
</data>
|
||||
</node>
|
||||
<edge id="e0" source="n1" target="n0">
|
||||
<data key="d8" xml:space="preserve"/>
|
||||
<data key="d10">
|
||||
<y:PolyLineEdge>
|
||||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
|
||||
<y:LineStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:Arrows source="none" target="none"/>
|
||||
<y:BendStyle smoothed="false"/>
|
||||
</y:PolyLineEdge>
|
||||
</data>
|
||||
</edge>
|
||||
<edge id="e1" source="n0" target="n2">
|
||||
<data key="d8" xml:space="preserve"/>
|
||||
<data key="d10">
|
||||
<y:PolyLineEdge>
|
||||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
|
||||
<y:LineStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:Arrows source="none" target="none"/>
|
||||
<y:BendStyle smoothed="false"/>
|
||||
</y:PolyLineEdge>
|
||||
</data>
|
||||
</edge>
|
||||
<edge id="e2" source="n0" target="n0">
|
||||
<data key="d8" xml:space="preserve"/>
|
||||
<data key="d9" xml:space="preserve"><![CDATA[asdsad
|
||||
]]></data>
|
||||
<data key="d10">
|
||||
<y:PolyLineEdge>
|
||||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0">
|
||||
<y:Point x="129.87046005726967" y="339.2515120967741"/>
|
||||
</y:Path>
|
||||
<y:LineStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:Arrows source="none" target="none"/>
|
||||
<y:EdgeLabel alignment="center" configuration="AutoFlippingLabel" distance="2.0" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="18.701171875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" preferredPlacement="anywhere" ratio="0.5" textColor="#000000" verticalTextPosition="bottom" visible="true" width="69.373046875" x="-247.37619167580988" xml:space="preserve" y="83.61574489684222"># forerunner<y:LabelModel><y:SmartEdgeLabelModel autoRotationEnabled="false" defaultAngle="0.0" defaultDistance="10.0"/></y:LabelModel><y:ModelParameter><y:SmartEdgeLabelModelParameter angle="0.0" distance="30.0" distanceToCenter="true" position="right" ratio="0.5" segment="0"/></y:ModelParameter><y:PreferredPlacementDescriptor angle="0.0" angleOffsetOnRightSide="0" angleReference="absolute" angleRotationOnRightSide="co" distance="-1.0" frozen="true" placement="anywhere" side="anywhere" sideReference="relative_to_edge_flow"/></y:EdgeLabel>
|
||||
<y:BendStyle smoothed="false"/>
|
||||
</y:PolyLineEdge>
|
||||
</data>
|
||||
</edge>
|
||||
<edge id="e3" source="n3" target="n4">
|
||||
<data key="d10">
|
||||
<y:PolyLineEdge>
|
||||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
|
||||
<y:LineStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:Arrows source="none" target="white_delta"/>
|
||||
<y:BendStyle smoothed="false"/>
|
||||
</y:PolyLineEdge>
|
||||
</data>
|
||||
</edge>
|
||||
<edge id="e4" source="n6" target="n7">
|
||||
<data key="d10">
|
||||
<y:PolyLineEdge>
|
||||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/>
|
||||
<y:LineStyle color="#000000" type="line" width="1.0"/>
|
||||
<y:Arrows source="none" target="white_delta"/>
|
||||
<y:BendStyle smoothed="false"/>
|
||||
</y:PolyLineEdge>
|
||||
</data>
|
||||
</edge>
|
||||
</graph>
|
||||
<data key="d7">
|
||||
<y:Resources/>
|
||||
</data>
|
||||
</graphml>
|
Loading…
Reference in New Issue
Block a user