com.partnersoft.maps.model
Class ElectricalConnectivityNode

java.lang.Object
  extended by com.partnersoft.maps.model.ElectricalConnectivityNode

public class ElectricalConnectivityNode
extends java.lang.Object

A node in an electrical distribution connectivity network. Nodes are identified with their rover data id, which allows you to directly look up the associated data and highlights in the map set. The various flags used for tracing, the type of the node, and the phasing and switching positions are all stored in binary form in a single two-byte short integer value. This is the same format used to store it on disk, so keeping it in that form eliminates the need to parse it for every node when you load the connectivity. Also, I'm not sure how big booleans variables really are when you store them in a Java object; they may or may not be efficient and we need this thing as tight as possible to save memory. However, convenience functions are provided to make life easy for programmers and scripters.

Author:
Paul Reavis Copyright 2005 Partner Software, Inc.

Field Summary
 int[] connections
           
static int FLAG_A_CURRENT
           
static int FLAG_A_NORMAL
           
static int FLAG_APHASE
           
static int FLAG_B_CURRENT
           
static int FLAG_B_NORMAL
           
static int FLAG_BPHASE
           
static int FLAG_C_CURRENT
           
static int FLAG_C_NORMAL
           
static int FLAG_CPHASE
           
static int FLAG_VISITED
           
 short flags
           
static int MASK_CURRENT
          The fifth three bits are the phases currently on.
static int MASK_NORMAL
          The fourth three bits are the phases normally on.
static int MASK_PHASE
          The third three bits are the available phases.
static int MASK_SUBTYPE
          The second three bits are the node subtype.
static int MASK_TYPE
          The first three bits are the node type.
static int MASK_VISITED
          And finally, a single bit to indicate whether the node has been visited during a traversal.
static Naming nameToType
           
 int nodeID
           
static int SUBTYPE_ARRESTOR
           
static int SUBTYPE_BREAKER
           
static int SUBTYPE_CAPACITOR
           
static int SUBTYPE_FEEDER
           
static int SUBTYPE_FUSE
           
static int SUBTYPE_GENERATOR
           
static int SUBTYPE_LIGHT
           
static int SUBTYPE_METER
           
static int SUBTYPE_METER_ON_POLE
           
static int SUBTYPE_NONE
           
static int SUBTYPE_PRIMARY_DEVICE
           
static int SUBTYPE_PRIMARY_LINE
           
static int SUBTYPE_PRIMARY_METER
           
static int SUBTYPE_PRIMARY_OH
           
static int SUBTYPE_PRIMARY_OPEN
           
static int SUBTYPE_PRIMARY_PROTECTION
           
static int SUBTYPE_PRIMARY_SWITCH
           
static int SUBTYPE_PRIMARY_UG
           
static int SUBTYPE_RECLOSER
           
static int SUBTYPE_REGULATOR
           
static int SUBTYPE_SECONDARY_DEVICE
           
static int SUBTYPE_SECONDARY_LINE
           
static int SUBTYPE_SECONDARY_OH
           
static int SUBTYPE_SECONDARY_UG
           
static int SUBTYPE_SECONDARY_UNDERBUILT
           
static int SUBTYPE_SECTIONALIZER
           
static int SUBTYPE_SERVICE
           
static int SUBTYPE_SOURCE
           
static int SUBTYPE_STEP_TRANSFORMER
           
static int SUBTYPE_SUBSTATION
           
static int SUBTYPE_TRANSFORMER
           
static int SUBTYPE_TRANSFORMER_OH
           
static int SUBTYPE_TRANSFORMER_UG
           
static int SUBTYPE_VOLTMETER
           
static int TYPE_PRIMARY_DEVICE
           
static int TYPE_PRIMARY_LINE
           
static int TYPE_PRIMARY_PROTECTION
           
static int TYPE_PRIMARY_SWITCH
           
static int TYPE_SECONDARY_DEVICE
           
static int TYPE_SECONDARY_LINE
           
static int TYPE_SOURCE
           
static int TYPE_TRANSFORMER
           
static java.lang.String[] typeToName
           
 
Constructor Summary
ElectricalConnectivityNode()
           
ElectricalConnectivityNode(int nodeID, short flags, int[] connections)
           
 
Method Summary
static java.lang.String[] decodeNodeData(int data)
           
static java.lang.String decodePhasing(int phasing)
           
static short encodeNodeData(java.lang.String typeName, java.lang.String phasing, java.lang.String switching)
           
static short encodeNodeData(java.lang.String typeName, java.lang.String phasing, java.lang.String switching, java.lang.String current)
           
static short encodeNodeData(java.lang.String typeName, java.lang.String phasing, java.lang.String switching, java.lang.String current, boolean visited)
           
static byte encodePhasing(java.lang.String phasing)
           
 java.lang.String getCurrentPhaseString()
           
 java.lang.String getDescription()
           
 java.lang.String getNormalPhaseString()
           
 java.lang.String getPresentPhaseString()
           
 java.lang.String getSubtype()
           
 int getSubtypeCode()
          Returns the six-bit subtype code (including the type code).
 int getTypeCode()
          Returns the three-bit type code.
 boolean isAPhaseCurrentlyOn()
          Returns true if "A" phase is currently on (connected).
 boolean isAPhaseNormallyOn()
          Returns true if "A" phase is normally on (connected).
 boolean isAPhasePresent()
          Returns true if "A" phase is present in this node.
 boolean isBPhaseCurrentlyOn()
          Returns true if "B" phase is currently on (connected).
 boolean isBPhaseNormallyOn()
          Returns true if "B" phase is normally on (connected).
 boolean isBPhasePresent()
          Returns true if "B" phase is present in this node.
 boolean isConnectedTo(int nodeIndex)
           
 boolean isCPhaseCurrentlyOn()
          Returns true if "A" phase is currently on (connected).
 boolean isCPhaseNormallyOn()
          Returns true if "A" phase is normally on (connected).
 boolean isCPhasePresent()
          Returns true if "C" phase is present in this node.
 boolean isDevice()
          Returns true if the node represents a primary device or switch.
 boolean isPhasingNormal()
          Returns true if the phases currently on differ from those normally on.
 boolean isPrimary()
          Returns true if the node represents a primary section or device.
 boolean isProtective()
          Returns true if the device is a protective device (fuse, recloser, etc.)
 boolean isSource()
          Returns true if the node represents a source for electrical power - generally a substation or substation breaker.
 boolean isSwitchable()
          Returns true if the device is normally considered a switch.
 boolean isTransformer()
          Returns true if the node represents a primary-to-secondary transformer.
 void resetPhaseCurrentlyOn()
          Resets current phasing to normal phasing.
 void setAPhaseCurrentlyOn(boolean tizit)
          Set current setting of "A" phase.
 void setBPhaseCurrentlyOn(boolean tizit)
          Set current setting of "B" phase.
 void setCPhaseCurrentlyOn(boolean tizit)
          Set current setting of "C" phase.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MASK_TYPE

public static final int MASK_TYPE
The first three bits are the node type.

See Also:
Constant Field Values

MASK_SUBTYPE

public static final int MASK_SUBTYPE
The second three bits are the node subtype.

See Also:
Constant Field Values

MASK_PHASE

public static final int MASK_PHASE
The third three bits are the available phases.

See Also:
Constant Field Values

MASK_NORMAL

public static final int MASK_NORMAL
The fourth three bits are the phases normally on.

See Also:
Constant Field Values

MASK_CURRENT

public static final int MASK_CURRENT
The fifth three bits are the phases currently on.

See Also:
Constant Field Values

MASK_VISITED

public static final int MASK_VISITED
And finally, a single bit to indicate whether the node has been visited during a traversal.

See Also:
Constant Field Values

TYPE_SOURCE

public static final int TYPE_SOURCE
See Also:
Constant Field Values

TYPE_PRIMARY_LINE

public static final int TYPE_PRIMARY_LINE
See Also:
Constant Field Values

TYPE_PRIMARY_DEVICE

public static final int TYPE_PRIMARY_DEVICE
See Also:
Constant Field Values

TYPE_PRIMARY_PROTECTION

public static final int TYPE_PRIMARY_PROTECTION
See Also:
Constant Field Values

TYPE_PRIMARY_SWITCH

public static final int TYPE_PRIMARY_SWITCH
See Also:
Constant Field Values

TYPE_TRANSFORMER

public static final int TYPE_TRANSFORMER
See Also:
Constant Field Values

TYPE_SECONDARY_LINE

public static final int TYPE_SECONDARY_LINE
See Also:
Constant Field Values

TYPE_SECONDARY_DEVICE

public static final int TYPE_SECONDARY_DEVICE
See Also:
Constant Field Values

SUBTYPE_NONE

public static final int SUBTYPE_NONE
See Also:
Constant Field Values

SUBTYPE_SOURCE

public static final int SUBTYPE_SOURCE
See Also:
Constant Field Values

SUBTYPE_BREAKER

public static final int SUBTYPE_BREAKER
See Also:
Constant Field Values

SUBTYPE_SUBSTATION

public static final int SUBTYPE_SUBSTATION
See Also:
Constant Field Values

SUBTYPE_FEEDER

public static final int SUBTYPE_FEEDER
See Also:
Constant Field Values

SUBTYPE_PRIMARY_LINE

public static final int SUBTYPE_PRIMARY_LINE
See Also:
Constant Field Values

SUBTYPE_PRIMARY_OH

public static final int SUBTYPE_PRIMARY_OH
See Also:
Constant Field Values

SUBTYPE_PRIMARY_UG

public static final int SUBTYPE_PRIMARY_UG
See Also:
Constant Field Values

SUBTYPE_PRIMARY_DEVICE

public static final int SUBTYPE_PRIMARY_DEVICE
See Also:
Constant Field Values

SUBTYPE_CAPACITOR

public static final int SUBTYPE_CAPACITOR
See Also:
Constant Field Values

SUBTYPE_REGULATOR

public static final int SUBTYPE_REGULATOR
See Also:
Constant Field Values

SUBTYPE_ARRESTOR

public static final int SUBTYPE_ARRESTOR
See Also:
Constant Field Values

SUBTYPE_GENERATOR

public static final int SUBTYPE_GENERATOR
See Also:
Constant Field Values

SUBTYPE_VOLTMETER

public static final int SUBTYPE_VOLTMETER
See Also:
Constant Field Values

SUBTYPE_STEP_TRANSFORMER

public static final int SUBTYPE_STEP_TRANSFORMER
See Also:
Constant Field Values

SUBTYPE_PRIMARY_PROTECTION

public static final int SUBTYPE_PRIMARY_PROTECTION
See Also:
Constant Field Values

SUBTYPE_FUSE

public static final int SUBTYPE_FUSE
See Also:
Constant Field Values

SUBTYPE_RECLOSER

public static final int SUBTYPE_RECLOSER
See Also:
Constant Field Values

SUBTYPE_PRIMARY_SWITCH

public static final int SUBTYPE_PRIMARY_SWITCH
See Also:
Constant Field Values

SUBTYPE_PRIMARY_OPEN

public static final int SUBTYPE_PRIMARY_OPEN
See Also:
Constant Field Values

SUBTYPE_SECTIONALIZER

public static final int SUBTYPE_SECTIONALIZER
See Also:
Constant Field Values

SUBTYPE_PRIMARY_METER

public static final int SUBTYPE_PRIMARY_METER
See Also:
Constant Field Values

SUBTYPE_TRANSFORMER

public static final int SUBTYPE_TRANSFORMER
See Also:
Constant Field Values

SUBTYPE_TRANSFORMER_OH

public static final int SUBTYPE_TRANSFORMER_OH
See Also:
Constant Field Values

SUBTYPE_TRANSFORMER_UG

public static final int SUBTYPE_TRANSFORMER_UG
See Also:
Constant Field Values

SUBTYPE_SECONDARY_LINE

public static final int SUBTYPE_SECONDARY_LINE
See Also:
Constant Field Values

SUBTYPE_SECONDARY_OH

public static final int SUBTYPE_SECONDARY_OH
See Also:
Constant Field Values

SUBTYPE_SECONDARY_UG

public static final int SUBTYPE_SECONDARY_UG
See Also:
Constant Field Values

SUBTYPE_SECONDARY_UNDERBUILT

public static final int SUBTYPE_SECONDARY_UNDERBUILT
See Also:
Constant Field Values

SUBTYPE_SECONDARY_DEVICE

public static final int SUBTYPE_SECONDARY_DEVICE
See Also:
Constant Field Values

SUBTYPE_LIGHT

public static final int SUBTYPE_LIGHT
See Also:
Constant Field Values

SUBTYPE_SERVICE

public static final int SUBTYPE_SERVICE
See Also:
Constant Field Values

SUBTYPE_METER

public static final int SUBTYPE_METER
See Also:
Constant Field Values

SUBTYPE_METER_ON_POLE

public static final int SUBTYPE_METER_ON_POLE
See Also:
Constant Field Values

FLAG_APHASE

public static final int FLAG_APHASE
See Also:
Constant Field Values

FLAG_BPHASE

public static final int FLAG_BPHASE
See Also:
Constant Field Values

FLAG_CPHASE

public static final int FLAG_CPHASE
See Also:
Constant Field Values

FLAG_A_NORMAL

public static final int FLAG_A_NORMAL
See Also:
Constant Field Values

FLAG_B_NORMAL

public static final int FLAG_B_NORMAL
See Also:
Constant Field Values

FLAG_C_NORMAL

public static final int FLAG_C_NORMAL
See Also:
Constant Field Values

FLAG_A_CURRENT

public static final int FLAG_A_CURRENT
See Also:
Constant Field Values

FLAG_B_CURRENT

public static final int FLAG_B_CURRENT
See Also:
Constant Field Values

FLAG_C_CURRENT

public static final int FLAG_C_CURRENT
See Also:
Constant Field Values

FLAG_VISITED

public static final int FLAG_VISITED
See Also:
Constant Field Values

typeToName

public static java.lang.String[] typeToName

nameToType

public static Naming nameToType

nodeID

public int nodeID

flags

public short flags

connections

public int[] connections
Constructor Detail

ElectricalConnectivityNode

public ElectricalConnectivityNode()

ElectricalConnectivityNode

public ElectricalConnectivityNode(int nodeID,
                                  short flags,
                                  int[] connections)
Method Detail

encodeNodeData

public static short encodeNodeData(java.lang.String typeName,
                                   java.lang.String phasing,
                                   java.lang.String switching)

encodeNodeData

public static short encodeNodeData(java.lang.String typeName,
                                   java.lang.String phasing,
                                   java.lang.String switching,
                                   java.lang.String current)

encodeNodeData

public static short encodeNodeData(java.lang.String typeName,
                                   java.lang.String phasing,
                                   java.lang.String switching,
                                   java.lang.String current,
                                   boolean visited)

decodeNodeData

public static java.lang.String[] decodeNodeData(int data)

encodePhasing

public static byte encodePhasing(java.lang.String phasing)

decodePhasing

public static java.lang.String decodePhasing(int phasing)

isSource

public boolean isSource()
Returns true if the node represents a source for electrical power - generally a substation or substation breaker.


isPrimary

public boolean isPrimary()
Returns true if the node represents a primary section or device. Returns false if the node represents a secondary section.


isDevice

public boolean isDevice()
Returns true if the node represents a primary device or switch.


isSwitchable

public boolean isSwitchable()
Returns true if the device is normally considered a switch. Note that all nodes are "switchable" as far as the model goes, however.


isProtective

public boolean isProtective()
Returns true if the device is a protective device (fuse, recloser, etc.)


isTransformer

public boolean isTransformer()
Returns true if the node represents a primary-to-secondary transformer.


getTypeCode

public int getTypeCode()
Returns the three-bit type code. Does not bit-shift it, so it will match the constants.


getSubtypeCode

public int getSubtypeCode()
Returns the six-bit subtype code (including the type code). Does not bit-shift it, so it will match the constants.


isAPhasePresent

public boolean isAPhasePresent()
Returns true if "A" phase is present in this node.


isBPhasePresent

public boolean isBPhasePresent()
Returns true if "B" phase is present in this node.


isCPhasePresent

public boolean isCPhasePresent()
Returns true if "C" phase is present in this node.


isAPhaseNormallyOn

public boolean isAPhaseNormallyOn()
Returns true if "A" phase is normally on (connected).


isBPhaseNormallyOn

public boolean isBPhaseNormallyOn()
Returns true if "B" phase is normally on (connected).


isCPhaseNormallyOn

public boolean isCPhaseNormallyOn()
Returns true if "A" phase is normally on (connected).


isAPhaseCurrentlyOn

public boolean isAPhaseCurrentlyOn()
Returns true if "A" phase is currently on (connected).


isBPhaseCurrentlyOn

public boolean isBPhaseCurrentlyOn()
Returns true if "B" phase is currently on (connected).


isCPhaseCurrentlyOn

public boolean isCPhaseCurrentlyOn()
Returns true if "A" phase is currently on (connected).


setAPhaseCurrentlyOn

public void setAPhaseCurrentlyOn(boolean tizit)
Set current setting of "A" phase.


setBPhaseCurrentlyOn

public void setBPhaseCurrentlyOn(boolean tizit)
Set current setting of "B" phase.


setCPhaseCurrentlyOn

public void setCPhaseCurrentlyOn(boolean tizit)
Set current setting of "C" phase.


resetPhaseCurrentlyOn

public void resetPhaseCurrentlyOn()
Resets current phasing to normal phasing.


isPhasingNormal

public boolean isPhasingNormal()
Returns true if the phases currently on differ from those normally on.


isConnectedTo

public boolean isConnectedTo(int nodeIndex)

getPresentPhaseString

public java.lang.String getPresentPhaseString()

getNormalPhaseString

public java.lang.String getNormalPhaseString()

getCurrentPhaseString

public java.lang.String getCurrentPhaseString()

getSubtype

public java.lang.String getSubtype()

getDescription

public java.lang.String getDescription()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object