Kaydet (Commit) 68cd011c authored tarafından Noel Grandin's avatar Noel Grandin

java: reduce scope, make some methods private

found by UCDetector

Change-Id: Ib1425edde146193a65c242dc159b7e3fbf0e4a2e
üst 70f56bc2
......@@ -270,7 +270,7 @@ public class LocalOfficeWindow
start();
}
void cancel()
private void cancel()
throws java.lang.InterruptedException
{
aWatchedThread = null;
......
......@@ -635,7 +635,7 @@ public class LocalOfficeConnection
/** creates a unique pipe name.
*/
static String getPipeName()
private static String getPipeName()
{
// turn user name into a URL and file system safe name (% chars will not work)
String aPipeName = System.getProperty("user.name") + OFFICE_ID_SUFFIX;
......
......@@ -254,7 +254,7 @@ public class LocalOfficeWindow
* The second NamedValue has the name "XEMBED" and the value is true, when the XEmbed
* protocol shall be used fore embedding the native Window.
*/
protected Any getWrappedWindowHandle()
private Any getWrappedWindowHandle()
{
NamedValue window = new NamedValue(
......
......@@ -799,7 +799,7 @@ public class OOoBean
@throws NoDocumentException
if no document is loaded
*/
public void storeToURL(
private void storeToURL(
final String aURL,
final com.sun.star.beans.PropertyValue aArguments[] )
throws
......@@ -1030,7 +1030,7 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
which can be obtained from a frame, to control toolbars. See also
{@link #setAllBarsVisible setAllBarsVisible}.
*/
protected void applyToolVisibilities()
private void applyToolVisibilities()
{
bIgnoreVisibility = true;
setMenuBarVisible( bMenuBarVisible );
......@@ -1050,7 +1050,7 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
which can be obtained from a frame, to control toolbars. See also
{@link #setAllBarsVisible}.
*/
protected boolean setToolVisible( String aProperty, String aResourceURL,
private boolean setToolVisible( String aProperty, String aResourceURL,
boolean bOldValue, boolean bNewValue )
throws
......@@ -1318,7 +1318,7 @@ xLayoutManager.showElement("private:resource/menubar/menubar");
a new array is created, aArgument added and the new
array returned.
*/
protected com.sun.star.beans.PropertyValue[] addArgument(
private com.sun.star.beans.PropertyValue[] addArgument(
com.sun.star.beans.PropertyValue aArguments[],
final com.sun.star.beans.PropertyValue aArgument )
{
......
......@@ -45,7 +45,7 @@ public class NativeStorageAccess {
throw new java.io.IOException();
}
}
public native void openStream(String name,String key, int mode);
private native void openStream(String name,String key, int mode);
public native void close(String name,String key) throws java.io.IOException;
public native long getFilePointer(String name,String key) throws java.io.IOException;
......
......@@ -30,7 +30,7 @@ public class StorageNativeInputStream {
public StorageNativeInputStream(String key,String _file) {
openStream(key,_file, NativeStorageAccess.READ);
}
public native void openStream(String key,String name, int mode);
private native void openStream(String key,String name, int mode);
public native int read(String key,String name) throws java.io.IOException;
public native int read(String key,String name,byte[] b, int off, int len) throws java.io.IOException;
public native void close(String key,String name) throws java.io.IOException;
......
......@@ -37,7 +37,7 @@ public class StorageNativeOutputStream {
openStream(name, (String)key, NativeStorageAccess.WRITE | NativeStorageAccess.TRUNCATE);
}
public native void openStream(String name,String key, int mode);
private native void openStream(String name,String key, int mode);
/**
* Writes <code>len</code> bytes from the specified byte array
* starting at offset <code>off</code> to this output stream.
......
......@@ -154,7 +154,7 @@ public abstract class AbstractDatabase implements DatabaseAccess
}
final protected void createDBDocument(final String _docURL) throws Exception
final private void createDBDocument(final String _docURL) throws Exception
{
m_databaseDocumentFile = _docURL;
......
......@@ -901,13 +901,13 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds)
private int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds)
{
return impl_waitForEvent(_eventQueue, _expectedEvent, _maxMilliseconds, 0);
}
int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds, int _firstQueueElementToCheck)
private int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds, int _firstQueueElementToCheck)
{
synchronized (_eventQueue)
{
......@@ -941,7 +941,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document.
}
void onDocumentEvent(DocumentEvent _Event)
private void onDocumentEvent(DocumentEvent _Event)
{
if ("OnTitleChanged".equals(_Event.EventName))
// OnTitleChanged events are notified too often. This is known, and accepted.
......
......@@ -176,7 +176,7 @@ public class Helper {
* cannot be read
*/
public ArrayList<String> getCSVFileContent(String csvFileName) {
private ArrayList<String> getCSVFileContent(String csvFileName) {
try {
ArrayList<String> content = new ArrayList<String>();
BufferedReader br;
......@@ -283,7 +283,7 @@ public class Helper {
* @param content content of a csv file
* @return a stripped Vector
*/
public ArrayList<String> removeSuperfluousContent(ArrayList<String> content){
private ArrayList<String> removeSuperfluousContent(ArrayList<String> content){
ArrayList<String> newContent = new ArrayList<String>();
Iterator<String> cont = content.iterator();
while( cont.hasNext() ) {
......@@ -366,7 +366,7 @@ public class Helper {
* type name. This information are extracted from "files.csv"
* This is for faster access to get fileURL and fileType of fileAlias
*/
public void createFilesList(){
private void createFilesList(){
for (int i = 0; i < m_vFiles.size();i++){
ArrayList<String> toDo = m_vFiles.get(i);
m_hFileURLs.put(toDo.get(0), toDo.get(1));
......@@ -405,7 +405,7 @@ public class Helper {
return dummy;
}
public URL getClassURL(String fileName){
private URL getClassURL(String fileName){
String PackagePath = this.getClass().getPackage().getName().replace('.','/');
return this.getClass().getResource("/" + PackagePath +"/" + fileName);
}
......
......@@ -174,7 +174,7 @@ public class CheckOGroupBoxModel
{
}
public boolean wasListenerCalled()
private boolean wasListenerCalled()
{
return propertiesChanged;
}
......
......@@ -65,7 +65,7 @@ public class DocumentHelper
}
/* ------------------------------------------------------------------ */
protected static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception
private static XComponent implLoadAsComponent( XMultiServiceFactory orb, String documentOrFactoryURL, final PropertyValue[] i_args ) throws com.sun.star.uno.Exception
{
XComponentLoader aLoader = UnoRuntime.queryInterface(
XComponentLoader.class,
......@@ -205,7 +205,7 @@ public class DocumentHelper
The initial name of the form. May be null, in this case the default (which
is an implementation detail) applies.
*/
protected XIndexContainer createSubForm( XIndexContainer xParentContainer, String sInitialName )
private XIndexContainer createSubForm( XIndexContainer xParentContainer, String sInitialName )
throws com.sun.star.uno.Exception
{
// create a new form
......@@ -296,7 +296,7 @@ public class DocumentHelper
/* ------------------------------------------------------------------ */
/** classifies a document
*/
public DocumentType classify( )
private DocumentType classify( )
{
XServiceInfo xSI = UnoRuntime.queryInterface(
XServiceInfo.class, m_documentComponent );
......
......@@ -87,7 +87,7 @@ public class DocumentViewHelper
@return
the dispatcher for the URL in question
*/
public XDispatch getDispatcher( URL[] aURL ) throws java.lang.Exception
private XDispatch getDispatcher( URL[] aURL ) throws java.lang.Exception
{
XDispatch xReturn = null;
......@@ -169,7 +169,7 @@ public class DocumentViewHelper
/* ------------------------------------------------------------------ */
/** retrieves the form controller for a given logical form
*/
public XFormController getFormController( XForm _form )
private XFormController getFormController( XForm _form )
{
XFormLayerAccess formLayerAccess = query( XFormLayerAccess.class );
return formLayerAccess.getFormController( _form );
......
......@@ -73,7 +73,7 @@ public class Instance
* @return
* the node of the newly created element
*/
public XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException
private XNode createElement( XNode _parentElement, String _elementName, String _initialNodeValue ) throws DOMException
{
XNode node = _parentElement.appendChild(
m_model.getUIHelper().createElement( _parentElement, _elementName )
......@@ -100,7 +100,7 @@ public class Instance
* @param _elementName
* the name of the to-be-removed child
*/
public XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
private XNode removeNode( XNode _parentElement, String _elementName ) throws DOMException
{
XNodeList nodes = _parentElement.getChildNodes();
for ( int i=0; i<nodes.getLength(); ++i )
......
......@@ -97,7 +97,7 @@ public class AutoSave
m_aLog.log(Protocol.TYPE_SCOPE_CLOSE, "");
}
public void disableListener()
private void disableListener()
{
m_aLog.log(Protocol.TYPE_SCOPE_OPEN, "stop listening for AutoSave notifications ...");
......
......@@ -272,7 +272,7 @@ public class Protocol extends JComponent
* format this line as a string for writing log files
* using the html format
*/
public synchronized String toHTML()
private synchronized String toHTML()
{
StringBuffer sLine = new StringBuffer(1000);
sLine.append("<tr>");
......@@ -716,7 +716,7 @@ public class Protocol extends JComponent
resetStatistics();
}
public synchronized void resetStatistics()
private synchronized void resetStatistics()
{
m_nTestMarks = 0;
m_nWarnings = 0;
......
......@@ -116,7 +116,7 @@ public class RecoveryTools {
/**
* halt the thread for some time
*/
public void pause(int sleepTime){
private void pause(int sleepTime){
sleep(sleepTime);
}
......
......@@ -86,7 +86,7 @@ public class DEPSAgent implements ILibEngine {
pbest_t = pbest;
}
protected AbsGTBehavior getGTBehavior() {
private AbsGTBehavior getGTBehavior() {
if (Math.random()<switchP) {
return deGTBehavior;
} else {
......
......@@ -77,7 +77,7 @@ public class DEGTBehavior extends AbsGTBehavior implements ILibEngine {
Library.replace(qualityComparator, trailPoint, pbest_t);
}
protected SearchPoint[] getReferPoints() {
private SearchPoint[] getReferPoints() {
SearchPoint[] referPoints = new SearchPoint[DVNum*2];
for(int i=0; i<referPoints.length; i++) {
referPoints[i] = socialLib.getSelectedPoint(RandomGenerator.intRangeRandom(0, socialLib.getPopSize()-1));
......
......@@ -53,13 +53,13 @@ public class GlobalString {
return getMeaningfulLine(outReader, NEGLECT_TAG);
}
public static int getCharLoc(char data, String str) {
private static int getCharLoc(char data, String str) {
for(int i=0; i<str.length(); i++) {
if(str.charAt(i)==data) return i;
}
return -1;
}
public static String trim(String origStr, String discardStr) {
private static String trim(String origStr, String discardStr) {
String str = origStr;
do {
if(str.length()==0) return str;
......@@ -69,7 +69,7 @@ public class GlobalString {
} while(true);
}
public static boolean getFirstCharExist(String str, String chars) throws Exception {
private static boolean getFirstCharExist(String str, String chars) throws Exception {
int neglectFirstCharLength = chars.length();
for(int i=0; i<neglectFirstCharLength; i++) {
if(str.startsWith(chars.substring(i, i+1))) {
......@@ -79,7 +79,7 @@ public class GlobalString {
return false;
}
public static String getMeaningfulLine(BufferedReader outReader, String neglectFirstChars) throws Exception {
private static String getMeaningfulLine(BufferedReader outReader, String neglectFirstChars) throws Exception {
String str;
boolean isNeglect = true;
do {
......@@ -95,7 +95,7 @@ public class GlobalString {
return str;
}
public static String[] getMeaningfulLines(String srcStr, String neglectFirstChars) throws Exception {
private static String[] getMeaningfulLines(String srcStr, String neglectFirstChars) throws Exception {
StringReader outStringReader = new StringReader(srcStr);
BufferedReader outReader = new BufferedReader(outStringReader);
ArrayList<String> origData = new ArrayList<String>();
......@@ -112,7 +112,7 @@ public class GlobalString {
/**
* convert vector to 1D String array
*/
public static String[] convert1DVectorToStringArray(ArrayList<String> toToConvert) {
private static String[] convert1DVectorToStringArray(ArrayList<String> toToConvert) {
if (toToConvert==null) return null;
String[] objs = new String[toToConvert.size()];
for (int i=0; i<toToConvert.size(); i++) {
......@@ -121,7 +121,7 @@ public class GlobalString {
return(objs);
}
public static String getObjString(Object nObj) {
private static String getObjString(Object nObj) {
if(nObj instanceof String) return (String)nObj;
return nObj.toString();
}
......
......@@ -89,7 +89,7 @@ public static double doubleRangeRandom(double lowLimit,double upLimit){
return realV;
}
public static int[] randomSelection(int[] totalIndices, int times) {
private static int[] randomSelection(int[] totalIndices, int times) {
if (times>=totalIndices.length) {
return totalIndices;
}
......
......@@ -56,7 +56,7 @@ public class ACRComparator implements IGoodnessCompareEngine, IUpdateCycleEngine
epsilon_t = lib.getExtremalVcon(true);
}
static public int compare(double data1, double data2) {
static private int compare(double data1, double data2) {
if (data1 < data2)
return LESS_THAN;
else if (data1 > data2)
......
......@@ -30,7 +30,7 @@ public class BCHComparator implements IGoodnessCompareEngine {
/* check the magnitude of two array, the frontial is more important
**/
public static int compareArray(double[] fit1, double[] fit2) {
private static int compareArray(double[] fit1, double[] fit2) {
for (int i=0; i<fit1.length; i++) {
if (fit1[i]>fit2[i]) {
return LARGER_THAN; //Large than
......
......@@ -81,7 +81,7 @@ public class SCAgent {
return trailPoint;
}
protected void generatePoint(ILocationEngine tempPoint) {
private void generatePoint(ILocationEngine tempPoint) {
SearchPoint Xmodel, Xrefer, libBPoint;
// choose Selects a better point (libBPoint) from externalLib (L) based
......@@ -115,7 +115,7 @@ public class SCAgent {
}
// 1---model point, 2---refer point
public boolean inferPoint(ILocationEngine newPoint, ILocationEngine point1,ILocationEngine point2, DesignSpace space){
private boolean inferPoint(ILocationEngine newPoint, ILocationEngine point1,ILocationEngine point2, DesignSpace space){
double[] newLoc = newPoint.getLocation();
double[] real1 = point1.getLocation();
double[] real2 = point2.getLocation();
......
......@@ -54,7 +54,7 @@ public class DesignSpace {
return dimProps[dim].paramBound.boundAdjust(val);
}
public void annulusAdjust (double[] location){
private void annulusAdjust (double[] location){
for (int i=0; i<getDimension(); i++) {
location[i] = dimProps[i].paramBound.annulusAdjust(location[i]);
}
......
......@@ -168,7 +168,7 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
protected IEvolutionarySolverStatusDialog m_solverStatusDialog;
protected void prepareVariables(double[][] variableBounds) {
private void prepareVariables(double[][] variableBounds) {
m_variables.clear();
for (int i = 0; i < m_variableCount; i++) {
Variable var = new Variable(m_variableMap[i], i);
......@@ -342,7 +342,7 @@ public abstract class BaseEvolutionarySolver extends BaseNLPSolver {
super.finalizeSolve();
}
protected boolean checkConstraints() {
private boolean checkConstraints() {
boolean result = true;
for (int i = 0; i < m_constraintCount && result; i++) {
if (m_extConstraints[i].Left.getError() == 0) {
......
......@@ -175,7 +175,7 @@ public abstract class BaseNLPSolver extends WeakBase
Row = row;
}
public CellRangeAddress getCellRangeAddress(int lastRow) {
private CellRangeAddress getCellRangeAddress(int lastRow) {
CellRangeAddress result = new CellRangeAddress();
result.Sheet = Sheet;
result.StartColumn = StartCol;
......@@ -341,11 +341,11 @@ public abstract class BaseNLPSolver extends WeakBase
return m_currentParameters;
}
protected XCell getCell(CellAddress cellAddress) {
private XCell getCell(CellAddress cellAddress) {
return getCell(cellAddress.Column, cellAddress.Row, cellAddress.Sheet);
}
protected XCell getCell(int col, int row, int sheet) {
private XCell getCell(int col, int row, int sheet) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
......@@ -365,7 +365,7 @@ public abstract class BaseNLPSolver extends WeakBase
cellRangeAddress.StartRow, cellRangeAddress.EndColumn, cellRangeAddress.EndRow);
}
protected XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) {
private XCellRangeData getCellRangeData(int sheet, int startCol, int startRow, int endCol, int endRow) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
......@@ -380,12 +380,12 @@ public abstract class BaseNLPSolver extends WeakBase
return null;
}
protected XChartDataArray getChartDataArray(CellRangeAddress cellRangeAddress) {
private XChartDataArray getChartDataArray(CellRangeAddress cellRangeAddress) {
return getChartDataArray(cellRangeAddress.Sheet, cellRangeAddress.StartColumn,
cellRangeAddress.StartRow, cellRangeAddress.EndColumn, cellRangeAddress.EndRow);
}
protected XChartDataArray getChartDataArray(int sheet, int startCol, int startRow, int endCol, int endRow) {
private XChartDataArray getChartDataArray(int sheet, int startCol, int startRow, int endCol, int endRow) {
try {
XSpreadsheets xSpreadsheets = m_document.getSheets();
XIndexAccess xSheetIndex = UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
......@@ -487,7 +487,7 @@ public abstract class BaseNLPSolver extends WeakBase
}
// <editor-fold defaultstate="collapsed" desc="Helper functions">
protected void lockDocument(boolean lock) {
private void lockDocument(boolean lock) {
if (lock)
m_xModel.lockControllers();
else
......
......@@ -102,7 +102,7 @@ public class Helper
public XModel createDocument( String sDocType )
private XModel createDocument( String sDocType )
{
XModel aResult = null;
try
......
......@@ -218,7 +218,7 @@ public class DialogComponent {
* static component initialisation functions as well as in
* getSupportedServiceNames.
*/
public static String[] getServiceNames() {
private static String[] getServiceNames() {
String[] sSupportedServiceNames = { __serviceName };
return sSupportedServiceNames;
}
......@@ -239,7 +239,7 @@ public class DialogComponent {
return _DialogComponent.class.getName();
}
public void showMessageBox(String sTitle, String sMessage) {
private void showMessageBox(String sTitle, String sMessage) {
if ( null != m_xFrame && null != m_xToolkit ) {
// describe window properties.
......
......@@ -86,7 +86,7 @@ public class RowSet
System.out.println(aNames[i]);
}
public static void useRowSet() throws com.sun.star.uno.Exception
private static void useRowSet() throws com.sun.star.uno.Exception
{
// first we create our RowSet object
XRowSet xRowRes = UnoRuntime.queryInterface(
......@@ -109,7 +109,7 @@ public class RowSet
System.out.println("RowSet destroyed!");
}
public static void showRowSetPrivileges() throws com.sun.star.uno.Exception
private static void showRowSetPrivileges() throws com.sun.star.uno.Exception
{
// first we create our RowSet object
XRowSet xRowRes = UnoRuntime.queryInterface(
......@@ -143,7 +143,7 @@ public class RowSet
System.out.println("RowSet destroyed!");
}
public static void showRowSetRowCount() throws com.sun.star.uno.Exception
private static void showRowSetRowCount() throws com.sun.star.uno.Exception
{
// first we create our RowSet object
XRowSet xRowRes = UnoRuntime.queryInterface(
......@@ -175,7 +175,7 @@ public class RowSet
System.out.println("RowSet destroyed!");
}
public static void showRowSetEvents() throws com.sun.star.uno.Exception
private static void showRowSetEvents() throws com.sun.star.uno.Exception
{
// first we create our RowSet object
XRowSet xRowRes = UnoRuntime.queryInterface(
......
......@@ -142,7 +142,7 @@ public class Sales
}
// inserts a row programmatically.
public void insertRow() throws com.sun.star.uno.Exception
private void insertRow() throws com.sun.star.uno.Exception
{
// example for a programmatic way to do updates.
XStatement stmt = con.createStatement();
......@@ -170,7 +170,7 @@ public class Sales
}
// deletes a row programmatically.
public void deleteRow() throws com.sun.star.uno.Exception
private void deleteRow() throws com.sun.star.uno.Exception
{
// example for a programmatic way to do updates.
XStatement stmt = con.createStatement();
......
......@@ -130,7 +130,7 @@ class ControlLock implements XRowSetListener
/* ------------------------------------------------------------------ */
/** updates the locks on the affected controls
*/
protected void updateLocks( )
private void updateLocks( )
{
try