com.ptc.wgmecad
Class BOMParser
java.lang.Object
com.ptc.wgmecad.BOMParser
- public class BOMParser
- extends Object
Created by IntelliJ IDEA.
User: barky
Date: Sep 30, 2003
Time: 2:48:09 PM
To change this template use Options | File Templates
Method Summary |
static Vector |
convertIntermediateBOM2CompFile(File bomOutput,
File compFile,
Properties totalProps)
Convert the bom produced by executeBOM int a component file digestible by Windchill, also
extract the properties from the BOM's TOTAL line. |
private static int |
findFirstIndexInMap(String[] partNumberStrs,
HashMap headerMap)
Look thru the array of possible headers and return the first one we find that actually occurs in the map. |
private static String[] |
getPartNameStrings()
|
private static String[] |
getPartNumberStrings()
|
private static Vector |
handleMultipleDelims(Vector toks,
String delim)
this consolidated consecutive non-blank tokens, and removes all blank tokens |
private static boolean |
hasAlphanumChars(String line)
|
private static boolean |
isHeaderLine(String[] partNumberStrs,
boolean headerRead,
String line,
BOMParser.ParseData pd)
|
static Object[][] |
parseCompFile(File compFile)
|
static Object[][] |
parseCompFile(Vector lines)
|
private static Vector |
parseHeaderLine(Vector toks,
HashMap headerMap,
String[] partNumberStrs,
BOMParser.ParseData pd,
String line)
|
private static void |
parseTotalLine(Vector toks,
Vector headerVec,
Properties totalProps)
|
private static String |
replaceColumnHeadingsRemovingSpaces(String[] headings,
String line,
String delim)
|
private static String |
stringReplace(String line,
String from,
String to)
|
private static Vector |
tokenizeHandlingQuotes(String line,
String delim)
handle lines from the bom output, using delim as the delimiter and treating quoted areas specially. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NAME_STRS
private static final String[] NAME_STRS
QTY_STRS
private static final String[] QTY_STRS
REFDES_STRS
private static final String[] REFDES_STRS
PART_NUMBER
private static final String PART_NUMBER
PART_NAME
private static final String PART_NAME
logger
static org.apache.log4j.Logger logger
BOMParser
public BOMParser()
convertIntermediateBOM2CompFile
public static Vector convertIntermediateBOM2CompFile(File bomOutput,
File compFile,
Properties totalProps)
throws IOException
- Convert the bom produced by executeBOM int a component file digestible by Windchill, also
extract the properties from the BOM's TOTAL line.
returns a vector of Object [] where the objects are strings of the form
{ "part_name", "quantity", "space separated ref des list" }
- Parameters:
bomOutput
- - name of the existing Cadence BOM in spreadsheet format (from executeBOM)compFile
- - name of the Windchill component file to be producedtotalProps
- - the properties object on which to set the bom total props
- Throws:
IOException
hasAlphanumChars
private static boolean hasAlphanumChars(String line)
replaceColumnHeadingsRemovingSpaces
private static String replaceColumnHeadingsRemovingSpaces(String[] headings,
String line,
String delim)
stringReplace
private static String stringReplace(String line,
String from,
String to)
getPartNameStrings
private static String[] getPartNameStrings()
getPartNumberStrings
private static String[] getPartNumberStrings()
parseTotalLine
private static void parseTotalLine(Vector toks,
Vector headerVec,
Properties totalProps)
parseHeaderLine
private static Vector parseHeaderLine(Vector toks,
HashMap headerMap,
String[] partNumberStrs,
BOMParser.ParseData pd,
String line)
isHeaderLine
private static boolean isHeaderLine(String[] partNumberStrs,
boolean headerRead,
String line,
BOMParser.ParseData pd)
handleMultipleDelims
private static Vector handleMultipleDelims(Vector toks,
String delim)
- this consolidated consecutive non-blank tokens, and removes all blank tokens
- Parameters:
toks
- delim
-
- Returns:
findFirstIndexInMap
private static int findFirstIndexInMap(String[] partNumberStrs,
HashMap headerMap)
- Look thru the array of possible headers and return the first one we find that actually occurs in the map.
- Parameters:
partNumberStrs
- headerMap
-
- Returns:
tokenizeHandlingQuotes
private static Vector tokenizeHandlingQuotes(String line,
String delim)
- handle lines from the bom output, using delim as the delimiter and treating quoted areas specially.
Quoted regions containing delim will be returned as a single token, with delim replaced with " ".
- Parameters:
line
- delim
-
- Returns:
parseCompFile
public static Object[][] parseCompFile(Vector lines)
throws BOMFileBadFormatException
- Throws:
BOMFileBadFormatException
parseCompFile
public static Object[][] parseCompFile(File compFile)
throws BOMFileBadFormatException
- Throws:
BOMFileBadFormatException