|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
utility.NightPlanner
public class NightPlanner
Nested Class Summary | |
---|---|
class |
NightPlanner.BarInfo
|
Field Summary | |
---|---|
java.awt.Color |
badBar
|
int |
barHeight
|
NightPlanner.BarInfo[] |
barInfos
|
double |
binPerMin
|
NightPlanner.BarInfo |
currentBar
|
int |
dragPos
|
boolean |
editMode
|
java.awt.FontMetrics |
fm
|
java.awt.Color |
goodBar
|
int |
height
|
boolean |
isFirstDraw
|
boolean |
loquacious
|
int |
nightLength
|
java.awt.Color |
noTimeBar
|
int |
numBars
|
int |
numFilts
|
java.awt.Dimension |
osD
|
java.awt.Graphics |
osG
|
java.awt.Image |
osImg
|
long |
possibleLoops
|
NightPlanner.BarInfo[] |
saveBars
|
java.awt.Font |
sfont
|
int |
smargin
|
int |
textheight
|
Sixty |
theStart
|
int |
tmargin
|
boolean |
tryReorder
|
java.awt.Color |
unusedBar
|
java.awt.Color |
whoopsBar
|
int |
width
|
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
NightPlanner()
|
Method Summary | |
---|---|
boolean |
addNextBar(java.lang.String[] night,
NightPlanner.BarInfo bar)
add a bar to the night as far left as possible. |
int |
amountOutsideRange(NightPlanner.BarInfo bar,
int min,
int max)
sees how much of a bar is currently outside a given range |
boolean |
betterToSwap(NightPlanner.BarInfo bar1,
NightPlanner.BarInfo bar2)
determines if swapping frees up space |
boolean |
canMove(java.lang.String[] night,
NightPlanner.BarInfo bar)
sees if moving will create enough space |
boolean |
canPush(java.lang.String[] night,
NightPlanner.BarInfo bar)
sees if pushing will create enough space |
boolean |
canReorder(java.lang.String[] night,
NightPlanner.BarInfo bar)
sees if reordering bars can free up enough space |
boolean |
canSwap(java.lang.String[] night,
NightPlanner.BarInfo bar)
sees if swapping will create enough space |
void |
cloneArray(java.lang.Object[] a1,
java.lang.Object[] a2)
fills the elements of one array (a1) with another (a2). |
static void |
fill(java.lang.String[] night,
NightPlanner.BarInfo bar,
int index)
adds a bar to the night centered at index |
int |
gainedByPushing(java.lang.String[] night,
NightPlanner.BarInfo bar,
boolean pushForward,
int errorReturn,
java.util.Vector pushList,
int limit)
sees how much you can gain by pushing another bar forward or backward |
java.util.Vector |
getAllBars(java.lang.String[] night)
gets all the bars on a night |
java.util.Vector |
getAllOverlappingBars(java.util.Vector allBars,
NightPlanner.BarInfo bar2,
java.util.Vector barList)
finds all bars that in some way connect to a given bar through overlap including bar |
NightPlanner.BarInfo |
getBar(java.lang.String name)
gets a bar given its name |
int |
getBarOverlap(NightPlanner.BarInfo bar1,
NightPlanner.BarInfo bar2)
gets the ammount of overlap of two bars |
java.util.Vector |
getPossibleNextBars(java.util.Vector bars,
int leftMostOpen)
gets the bars that can go before all the other bars |
void |
getSwapList(java.util.Vector swapList,
NightPlanner.BarInfo bar,
java.util.Vector excludeBars)
finds which bars in the list (excluding excludeBar) can be swapped with bar. |
static boolean |
isBlocked(java.lang.String[] night,
NightPlanner.BarInfo bar,
int index)
sees if there is free space to add a bar centered at index |
void |
joinTwoVectors(java.util.Vector vec1,
java.util.Vector vec2)
adds the elements of the second Vector to the first |
void |
move(java.lang.String[] night,
NightPlanner.BarInfo bar)
tries moving bar to free space |
void |
paint(java.awt.Graphics g)
|
void |
plan()
tries to organize the bars efficiently using as many as possible w/o overlap |
boolean |
probInNight(java.lang.String[] night)
tests for problems in night[] |
void |
processMouseEvent(java.awt.event.MouseEvent e)
handles mouse clicks - mouseDown |
void |
processMouseMotionEvent(java.awt.event.MouseEvent e)
handles mouse clicks - mouseDrag |
void |
push(java.lang.String[] night,
java.util.Vector pushList,
boolean pushForward,
int dist)
finds all the seems between the bars and tries to push them out to make room for the next bar. |
java.lang.String[] |
refillNight(java.lang.String[] night)
clears the night and adds everything again |
boolean |
reorder(java.lang.String[] night,
java.util.Vector remainingBars,
int leftMostOpen)
tries reordering bars to free up more space |
void |
restore()
restores the last saved bar state |
void |
save()
saves the current bar state |
void |
setUpBars(java.util.Vector candNames,
java.util.Vector riseTimes,
java.util.Vector setTimes,
java.util.Vector expTimes,
double nightBegin,
double nightEnd,
int slewTime,
int readoutTime,
Sixty theStart)
|
void |
swap(java.lang.String[] night,
NightPlanner.BarInfo bar)
tries swapping neighboring bars to free up more space |
void |
update(java.awt.Graphics g)
|
Methods inherited from class java.awt.Canvas |
---|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.awt.Image osImg
public java.awt.Graphics osG
public boolean isFirstDraw
public java.awt.Dimension osD
public int height
public int width
public int tmargin
public int smargin
public int nightLength
public int barHeight
public int numBars
public java.awt.Color goodBar
public java.awt.Color badBar
public java.awt.Color unusedBar
public java.awt.Color whoopsBar
public java.awt.Color noTimeBar
public NightPlanner.BarInfo[] barInfos
public NightPlanner.BarInfo currentBar
public java.awt.Font sfont
public java.awt.FontMetrics fm
public int textheight
public NightPlanner.BarInfo[] saveBars
public boolean editMode
public int dragPos
public boolean tryReorder
public boolean loquacious
public long possibleLoops
public int numFilts
public double binPerMin
public Sixty theStart
Constructor Detail |
---|
public NightPlanner()
Method Detail |
---|
public void setUpBars(java.util.Vector candNames, java.util.Vector riseTimes, java.util.Vector setTimes, java.util.Vector expTimes, double nightBegin, double nightEnd, int slewTime, int readoutTime, Sixty theStart)
public void plan()
public boolean canMove(java.lang.String[] night, NightPlanner.BarInfo bar)
public void move(java.lang.String[] night, NightPlanner.BarInfo bar)
public boolean canPush(java.lang.String[] night, NightPlanner.BarInfo bar)
public int gainedByPushing(java.lang.String[] night, NightPlanner.BarInfo bar, boolean pushForward, int errorReturn, java.util.Vector pushList, int limit)
public void push(java.lang.String[] night, java.util.Vector pushList, boolean pushForward, int dist)
public boolean canSwap(java.lang.String[] night, NightPlanner.BarInfo bar)
public void swap(java.lang.String[] night, NightPlanner.BarInfo bar)
public java.util.Vector getAllBars(java.lang.String[] night)
public java.lang.String[] refillNight(java.lang.String[] night)
public java.util.Vector getPossibleNextBars(java.util.Vector bars, int leftMostOpen)
public void cloneArray(java.lang.Object[] a1, java.lang.Object[] a2)
public boolean canReorder(java.lang.String[] night, NightPlanner.BarInfo bar)
public boolean reorder(java.lang.String[] night, java.util.Vector remainingBars, int leftMostOpen)
public boolean addNextBar(java.lang.String[] night, NightPlanner.BarInfo bar)
public java.util.Vector getAllOverlappingBars(java.util.Vector allBars, NightPlanner.BarInfo bar2, java.util.Vector barList)
public void joinTwoVectors(java.util.Vector vec1, java.util.Vector vec2)
public void getSwapList(java.util.Vector swapList, NightPlanner.BarInfo bar, java.util.Vector excludeBars)
public int getBarOverlap(NightPlanner.BarInfo bar1, NightPlanner.BarInfo bar2)
public boolean betterToSwap(NightPlanner.BarInfo bar1, NightPlanner.BarInfo bar2)
public int amountOutsideRange(NightPlanner.BarInfo bar, int min, int max)
public NightPlanner.BarInfo getBar(java.lang.String name)
public static boolean isBlocked(java.lang.String[] night, NightPlanner.BarInfo bar, int index)
public static void fill(java.lang.String[] night, NightPlanner.BarInfo bar, int index)
public boolean probInNight(java.lang.String[] night)
public void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent
in class java.awt.Component
public void processMouseMotionEvent(java.awt.event.MouseEvent e)
processMouseMotionEvent
in class java.awt.Component
public void update(java.awt.Graphics g)
update
in class java.awt.Canvas
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
public void save()
public void restore()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |