index int64 0 0 | repo_id stringlengths 9 205 | file_path stringlengths 31 246 | content stringlengths 1 12.2M | __index_level_0__ int64 0 10k |
|---|---|---|---|---|
0 | Create_ds/airavata-sandbox/allocation-manager/Notification-Manager/Notification-Sender/src/main/java/org/apache/airavata/allocation/manager/notification | Create_ds/airavata-sandbox/allocation-manager/Notification-Manager/Notification-Sender/src/main/java/org/apache/airavata/allocation/manager/notification/models/EmailCredentials.java | package org.apache.airavata.allocation.manager.notification.models;
public class EmailCredentials {
String userName;
String password;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| 9,100 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/drivers | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/drivers/auroraDriver/AuroraAdminDriver.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.drivers.auroraDriver;
// TODO: need javadoc documentation at the top of each method
// TODO: individually import the types
import java.util.*;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
import org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient.AuroraJobSchedulerI;
import org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient.AuroraJobSchedulerImpl;
import org.apache.airavata.cloud.bigDataInjections.AuroraInjectorImpl;
import org.apache.airavata.cloud.bigDataInjections.BigDataInjectorI;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
import org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient.MarathonJobSchedulerI;
import org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient.MarathonJobSchedulerImpl;
import org.apache.airavata.cloud.bigDataInjections.MarathonInjectorImpl;
public class AuroraAdminDriver{
public static void main(String[] args) {
// TODO: do command line validation
// Processing of the command line arguments should be moved to a different method
// This code to add command line arguments is based on Apache Commons
// TODO: explain why this Map data structure is needed
Map<String, List<String>> params = new HashMap<>();
// TODO: explain what is the purpose of this List
List<String> options = null;
for (int i = 0; i < args.length; i++) {
final String a = args[i];
if (a.charAt(0) == '-') {
if (a.length() < 2) {
// TOOD: need more details in the error statement
System.err.println("Error at argument " + a);
return;
}
// TODO: explain the purpose of this ArrayList
options = new ArrayList<>();
params.put(a.substring(1), options);
}
// TODO: explain when this "else" branch is taken
else if (options != null) {
options.add(a);
}
else {
System.err.println("Illegal parameter \n[USAGE]\nOptions:\n1) -o\tcreate, kill, restart, update, update-info, update-pause\n2) -n\tname of the job\n 3) -r\tamount of RAM\n 4) -c\tCPU count\n 5) -d\tdisk space\n 6) -k\tname of the task to be killed\n 7) -i\texecutable/image\n ");
return;
}
}// end of for (int i=0; ...
// use the code below to decide between injecting Aurora, Marathon, etc. as injections
AuroraJobSchedulerI auroraJS = new AuroraJobSchedulerImpl();
BigDataInjectorI auroraInjector = new AuroraInjectorImpl(auroraJS);
auroraInjector.executeTheBigDataClientSideCommand(params);
// UNCOMMENT NEXT 3 LINES TO USE MARATHON and comment the 3 lines above to shut AURORA off.
/*MarathonJobSchedulerI marathonJS = new MarathonJobSchedulerImpl();
BigDataInjectorI marathonInjector = new MarathonInjectorImpl(marathonJS);
marathonInjector.executeTheBigDataClientSideCommand(params);*/
} // end of public static void main
} // end of class
| 9,101 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util/marathonUtilities/MarathonUtilI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.util.marathonUtilities;
import java.io.BufferedReader;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
public interface MarathonUtilI{
public void printLog(BufferedReader stdout) throws MarathonException;
public BufferedReader executeProcess(String commandToRunProcess) throws MarathonException;
}
| 9,102 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util/marathonUtilities/MarathonUtilImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.util.marathonUtilities;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
public class MarathonUtilImpl implements MarathonUtilI{
public void printLog(BufferedReader stdout) throws MarathonException
{
try{
String line;
line = stdout.readLine();
while (line != null) {
System.out.println(line);
line = stdout.readLine();
}
}
catch (IOException ex) {
throw new MarathonException("IO Exception occured while passing the command.\n"+ex.toString());
}
}
public BufferedReader executeProcess(String commandToRunProcess) throws MarathonException
{
BufferedReader stdout = null;
try{
Process marathonJob = Runtime.getRuntime().exec(commandToRunProcess);
marathonJob.waitFor();
stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
}
catch(Exception ex)
{
throw new MarathonException("Exception occured while passing the command.\n"+ex.toString());
}
return stdout;
}
}
| 9,103 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util/auroraUtilities/AuroraUtilImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.util.auroraUtilities;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
public class AuroraUtilImpl implements AuroraUtilI{
public void printLog(BufferedReader stdout) throws AuroraException
{
try{
String line;
line = stdout.readLine();
while (line != null) {
System.out.println(line);
line = stdout.readLine();
}
}
catch (IOException ex) {
throw new AuroraException("IO Exception occured while passing the command.\n"+ex.toString());
}
}
public BufferedReader executeProcess(String commandToRunProcess) throws AuroraException
{
BufferedReader stdout = null;
try{
Process auroraJob = Runtime.getRuntime().exec(commandToRunProcess);
auroraJob.waitFor();
stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
}
catch(Exception ex)
{
throw new AuroraException("Exception occured while passing the command.\n"+ex.toString());
}
return stdout;
}
}
| 9,104 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/util/auroraUtilities/AuroraUtilI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.util.auroraUtilities;
import java.io.BufferedReader;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
public interface AuroraUtilI{
public void printLog(BufferedReader stdout) throws AuroraException;
public BufferedReader executeProcess(String commandToRunProcess) throws AuroraException;
}
| 9,105 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/marathon | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/marathon/marathonClient/MarathonJobSchedulerImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
import org.apache.airavata.cloud.util.marathonUtilities.MarathonUtilImpl;
import org.apache.airavata.cloud.util.marathonUtilities.MarathonUtilI;
public class MarathonJobSchedulerImpl implements MarathonJobSchedulerI {
MarathonUtilI util = new MarathonUtilImpl();
public void jobKill(String name, String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X DELETE "+address+""+name;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while launching the job.\n"+ex.toString());
}
}
public void jobLaunch(String name, String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X POST "+address+"/v2/apps -d @"+name+" -H Content-type: application/json";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while launching the job.\n"+ex.toString());
}
}
public void configCreate(String name, String ram, String cpu, String disk, String image, String command) throws MarathonException{
try {
String config = "'id': "+name+",'cmd': \""+command+"\", \"container\": {\"type\": \"DOCKER\", \"docker\": {\"image\": \"danielpan/dacapo\", \"forcePullImage\": bool(1)}},\"constraints\":[[\"hostname\",\"UNIQUE\"]],\"cpus\": float("+cpu+"), \"mem\": "+ram+"), \"disk\": "+disk+", \"instances\": 1";
File file = new File(name+".json");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(config);
bw.close();
}catch (IOException ex) {
throw new MarathonException("IO Exception occured while creating the configuration file.\n"+ex.toString());
}catch (Exception ex) {
throw new MarathonException("Exception occured while creating the configuration file.\n"+ex.toString());
}
}
public void jobList(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/apps";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobListById(String address, String id) throws MarathonException{
try{
String completeCommandToRunProcess ="curl GET "+address+"/v2/apps/"+id;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobListByName(String address, String name) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/apps/"+name;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobDelete(String address, String appid) throws MarathonException{
try{
String completeCommandToRunProcess = "curl DELETE "+address+"/v2/apps/"+appid+"/tasks";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void runningJobs(String address, String appid) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/apps/"+appid+"/tasks";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void createGroups(String address, String json) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X POST -H \"Content-type: application/json\" "+address+"/v2/groups/"+json;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while creating the group.\n"+ex.toString());
}
}
public void groups(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/groups/";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of groups.\n"+ex.toString());
}
}
public void groupsId(String address, String groupid) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/groups/"+groupid;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of groups.\n"+ex.toString());
}
}
public void jobDeleteId(String address, String appid, String taskid) throws MarathonException{
try{
String completeCommandToRunProcess = "curl DELETE "+address+"/v2/apps/"+appid+"/"+taskid;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void deleteDeployment(String address, String id) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X DELETE "+address+"/v2/deployments/"+id;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while deleting the deployment.\n"+ex.toString());
}
}
public void deploymentList(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/deployments/";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of deployment.\n"+ex.toString());
}
}
public void deleteGroups(String address, String id) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X DELETE "+address+"/v2/groups/"+id;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while deleting the group.\n"+ex.toString());
}
}
public void launchQueue(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/queue";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the launch queue.\n"+ex.toString());
}
}
public void eventSubscriptionList(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/eventSubscriptions";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of event subscriptions.\n"+ex.toString());
}
}
public void eventsList(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/events";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of events.\n"+ex.toString());
}
}
public void deleteMarathonLeader(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl -X DELETE "+address+"/v2/leader";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the launch queue.\n"+ex.toString());
}
}
public void marathonLeader(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/leader";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the leader information.\n"+ex.toString());
}
}
public void marathonInfo(String address) throws MarathonException{
try{
String completeCommandToRunProcess = "curl GET "+address+"/v2/info";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the marathon information.\n"+ex.toString());
}
}
}
| 9,106 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/marathon | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/marathon/marathonClient/MarathonJobSchedulerI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
public interface MarathonJobSchedulerI {
public void jobKill(String kill, String address) throws MarathonException;
public void jobLaunch(String name, String address) throws MarathonException;
public void configCreate(String name, String ram, String cpu, String disk, String image, String command) throws MarathonException;
public void jobList(String address) throws MarathonException;
public void jobListById(String address, String id) throws MarathonException;
public void jobListByName(String address, String name) throws MarathonException;
public void jobDelete(String address, String appid) throws MarathonException;
public void runningJobs(String address, String appid) throws MarathonException;
public void createGroups(String address, String json) throws MarathonException;
public void groups(String address) throws MarathonException;
public void groupsId(String address, String groupid) throws MarathonException;
public void jobDeleteId(String address, String appid, String taskid) throws MarathonException;
public void deleteDeployment(String address, String id) throws MarathonException;
public void deploymentList(String address) throws MarathonException;
public void deleteGroups(String address, String id) throws MarathonException;
public void eventsList(String address) throws MarathonException;
public void eventSubscriptionList(String address) throws MarathonException;
public void launchQueue(String address) throws MarathonException;
public void deleteMarathonLeader(String address) throws MarathonException;
public void marathonLeader(String address) throws MarathonException;
public void marathonInfo(String address) throws MarathonException;
}
| 9,107 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/aurora | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/aurora/auroraClient/AuroraJobSchedulerImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
import org.apache.airavata.cloud.util.auroraUtilities.AuroraUtilImpl;
import org.apache.airavata.cloud.util.auroraUtilities.AuroraUtilI;
public class AuroraJobSchedulerImpl implements AuroraJobSchedulerI {
AuroraUtilI util = new AuroraUtilImpl();
public void auroraJobCommand(String info, String command) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora task run example/benchmarks/devel/"+info+" "+command;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while passing the command.\n"+ex.toString());
}
}
public void jobUpdateList(String info) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora update list example/benchmarks/devel/"+info;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while listing the update.\n"+ex.toString());
}
}
public void jobUpdateAbort(String info) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora abort pause example/benchmarks/devel/"+info;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while aborting the update.\n"+ex.toString());
}
}
public void jobUpdateResume(String info) throws AuroraException{
try{
String completeCommandToRunProcess ="aurora update resume example/benchmarks/devel/"+info;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while resuming the update.\n"+ex.toString());
}
}
public void jobUpdatePause(String info) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora update pause example/benchmarks/devel/"+info;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while pausing the update.\n"+ex.toString());
}
}
public void jobUpdateInfo(String info) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora update info example/benchmarks/devel/"+info;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the update info."+ex.toString());
}
}
public void jobUpdate(String update) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora update start example/benchmarks/devel/"+update+" "+update+".aurora";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while updating the job.\n"+ex.toString());
}
}
public void jobRestart(String restart) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job restart example/benchmarks/devel/"+restart;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while restarting the job.\n"+ex.toString());
}
}
public void jobKill(String kill) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job killall example/benchmarks/devel/"+kill;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while killing the job.\n"+ex.toString());
}
}
public void jobLaunch(String name) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job create example/benchmarks/devel/"+name+" "+name+".aurora";
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while launching the job.\n"+ex.toString());
}
}
public void configCreate(String name, String ram, String cpu, String disk, String image) throws AuroraException{
try {
String config = "import hashlib\n"+name+"= Process(name = '"+name+"', cmdline = 'java -jar /dacapo-9.12-bach.jar "+name+" -s small')\n"+name+"_task = SequentialTask(processes = [ "+name+"], resources = Resources(cpu = "+cpu+", ram = "+ram+"*MB, disk="+disk+"*MB))\njobs = [ Job(cluster = 'example', environment = 'devel', role = 'benchmarks', name = '"+name+"', task = "+name+"_task, instances =1 , container = Container(docker = Docker(image = '"+image+"')))]\n";
File file = new File(name+".aurora");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(config);
bw.close();
}catch (IOException ex) {
throw new AuroraException("IO Exception occured while creating the configuration file.\n"+ex.toString());
}catch (Exception ex) {
throw new AuroraException("Exception occured while creating the configuration file.\n"+ex.toString());
}
}
public void jobDiff(String key, String config) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job diff "+key+" "+config;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the job difference.\n"+ex.toString());
}
}
public void configList(String config) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora config list "+config;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the list of jobs.\n"+ex.toString());
}
}
public void jobInspect(String key, String config) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job inspect "+key+" "+config;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while inspecting the job.\n"+ex.toString());
}
}
public void clusterQuota(String key) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora quota get "+key;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the production quota of the cluster.\n"+ex.toString());
}
}
public void openWebUI(String key) throws AuroraException{
try{
String completeCommandToRunProcess = "aurora job open "+key;
BufferedReader stdout = util.executeProcess(completeCommandToRunProcess);
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while opening the browser.\n"+ex.toString());
}
}
}
| 9,108 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/aurora | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataClientSideServices/aurora/auroraClient/AuroraJobSchedulerI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
public interface AuroraJobSchedulerI {
public void auroraJobCommand(String info, String command) throws AuroraException;
public void jobUpdateList(String info) throws AuroraException;
public void jobUpdateAbort(String info) throws AuroraException;
public void jobUpdateResume(String info) throws AuroraException;
public void jobUpdatePause(String info) throws AuroraException;
public void jobUpdateInfo(String info) throws AuroraException;
public void jobUpdate(String update) throws AuroraException;
public void jobRestart(String restart) throws AuroraException;
public void jobKill(String kill) throws AuroraException;
public void jobLaunch(String name) throws AuroraException;
public void configCreate(String name, String ram, String cpu, String disk, String image) throws AuroraException;
public void jobDiff(String key, String config) throws AuroraException;
public void configList(String config) throws AuroraException;
public void jobInspect(String key, String config) throws AuroraException;
public void clusterQuota(String key) throws AuroraException;
public void openWebUI(String key) throws AuroraException;
}
| 9,109 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/exceptions | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/exceptions/auroraExceptions/AuroraException.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.exceptions.auroraExceptions;
public class AuroraException extends Exception {
private String exceptionMsg;
public AuroraException(){
exceptionMsg="";
}
public AuroraException(String exceptionMsgIn){
exceptionMsg=exceptionMsgIn;;
}
public String toString(){
return this.exceptionMsg;
}
}
| 9,110 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/exceptions | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/exceptions/marathonExceptions/MarathonException.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.exceptions.marathonExceptions;
public class MarathonException extends Exception {
private String exceptionMsg;
public MarathonException(){
exceptionMsg="";
}
public MarathonException(String exceptionMsgIn){
exceptionMsg=exceptionMsgIn;;
}
public String toString(){
return this.exceptionMsg;
}
}
| 9,111 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataInjections/AuroraInjectorImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataInjections;
import java.util.Map;
import java.util.List;
import org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient.AuroraJobSchedulerI;
import org.apache.airavata.cloud.bigDataClientSideServices.aurora.auroraClient.AuroraJobSchedulerImpl;
import org.apache.airavata.cloud.exceptions.auroraExceptions.AuroraException;
public class AuroraInjectorImpl implements BigDataInjectorI {
private AuroraJobSchedulerI auroraJS = null;
public AuroraInjectorImpl(AuroraJobSchedulerI auroraJSIn) {
auroraJS = auroraJSIn;
}
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions) {
String commandName = commandLineOptions.get("o").get(0);
String RamSize, JobName, CpuCount, DiskSize, Image;
switch(commandName)
{
case "kill" :
try {
auroraJS.jobKill(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "restart" :
try {
auroraJS.jobRestart(commandLineOptions.get("n").get(0));
} catch (AuroraException ex) {
} break;
case "update" :
try {
auroraJS.jobUpdate(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "update-info" :
try {
auroraJS.jobUpdateInfo(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "update-pause" :
try {
auroraJS.jobUpdatePause(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "inspect" :
try {
auroraJS.jobInspect(commandLineOptions.get("n").get(0), commandLineOptions.get("k").get(0));
} catch(AuroraException ex){
} break;
case "quota" :
try {
auroraJS.clusterQuota(commandLineOptions.get("k").get(0));
} catch(AuroraException ex){
} break;
case "create" :
JobName = commandLineOptions.get("n").get(0);
RamSize = commandLineOptions.get("r").get(0);
CpuCount = commandLineOptions.get("c").get(0);
DiskSize = commandLineOptions.get("d").get(0);
Image = commandLineOptions.get("i").get(0);
try {
auroraJS.configCreate(JobName,RamSize,CpuCount,DiskSize,Image);
} catch (AuroraException ex) {}
try {
auroraJS.jobLaunch(JobName);
} catch (AuroraException ex) {
} break;
default :
System.out.println("Improper option\nOptions available:\n1) create\n2) kill\n3) restart\n4) update\n 5) update-info\n6) update-pause\n");
}
} // end of public void executeTheBigDataCommand
} // end of public class AuroraInjectorImpl
| 9,112 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataInjections/MarathonInjectorImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataInjections;
import java.util.Map;
import java.util.List;
import org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient.MarathonJobSchedulerI;
import org.apache.airavata.cloud.bigDataClientSideServices.marathon.marathonClient.MarathonJobSchedulerImpl;
import org.apache.airavata.cloud.exceptions.marathonExceptions.MarathonException;
public class MarathonInjectorImpl implements BigDataInjectorI {
private MarathonJobSchedulerI marathonJS = null;
public MarathonInjectorImpl(MarathonJobSchedulerI marathonJSIn) {
marathonJS = marathonJSIn;
}
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions) {
String commandName = commandLineOptions.get("o").get(0);
String RamSize, JobName, CpuCount, DiskSize, Image, Command;
switch(commandName)
{
case "kill" :
try {
marathonJS.jobKill(commandLineOptions.get("n").get(0),commandLineOptions.get("a").get(0));
} catch(MarathonException ex){
} break;
case "create" :
JobName = commandLineOptions.get("n").get(0);
RamSize = commandLineOptions.get("r").get(0);
CpuCount = commandLineOptions.get("c").get(0);
DiskSize = commandLineOptions.get("d").get(0);
Image = commandLineOptions.get("i").get(0);
Command = commandLineOptions.get("a").get(0);
try {
marathonJS.configCreate(JobName,RamSize,CpuCount,DiskSize,Image, Command);
} catch (MarathonException ex) {}
try {
marathonJS.jobLaunch(JobName,commandLineOptions.get("a").get(0));
} catch (MarathonException ex) {
} break;
default :
System.out.println("Improper option\nOptions available:\n1) create\n2) kill\n");
}
} // end of public void executeTheBigDataCommand
} // end of public class AuroraInjectorImpl
| 9,113 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/AuroraMarathonIntegration/src/main/java/org/apache/airavata/cloud/bigDataInjections/BigDataInjectorI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.cloud.bigDataInjections;
import java.util.Map;
import java.util.List;
public interface BigDataInjectorI {
// TODO: this interface should throw an exception
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions);
}
| 9,114 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/authentication/GSIAuthenticationInfo.java | /**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.airavata.gfac.core.authentication;
import org.ietf.jgss.GSSCredential;
import java.util.Properties;
/**
* Authentication data. Could be MyProxy user name, password, could be GSSCredentials
* or could be SSH keys.
*/
public abstract class GSIAuthenticationInfo implements AuthenticationInfo {
public Properties properties = new Properties();
public abstract GSSCredential getCredentials() throws SecurityException;
public Properties getProperties() {
return properties;
}
public void setProperties(Properties propertiesIn) {
properties = propertiesIn;
}
}
| 9,115 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/authentication/SSHPasswordAuthentication.java | /**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.airavata.gfac.core.authentication;
/**
* Password authentication for vanilla SSH.
*/
public class SSHPasswordAuthentication implements AuthenticationInfo {
private String userName;
private String password;
public SSHPasswordAuthentication(String userNameIn, String passwordIn) {
this.userName = userNameIn;
this.password = passwordIn;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
}
| 9,116 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/authentication/SSHKeyAuthentication.java | /**
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.airavata.gfac.core.authentication;
/**
* User: AmilaJ (amilaj@apache.org)
* Date: 10/4/13
* Time: 2:39 PM
*/
/**
* Abstracts out common methods for SSH key authentication.
*/
public class SSHKeyAuthentication implements AuthenticationInfo {
private String userName;
private byte[] privateKey;
private byte[] publicKey;
private String passphrase;
private String knownHostsFilePath;
private String strictHostKeyChecking; // yes or no
public SSHKeyAuthentication() {
}
public String getUserName() {
return userName;
}
public void setUserName(String userNameIn) {
this.userName = userNameIn;
}
public byte[] getPrivateKey() {
return privateKey;
}
public void setPrivateKey(byte[] privateKeyIn) {
this.privateKey = privateKeyIn;
}
public byte[] getPublicKey() {
return publicKey;
}
public void setPublicKey(byte[] publicKeyIn) {
this.publicKey = publicKeyIn;
}
public String getPassphrase() {
return passphrase;
}
public void setPassphrase(String passphraseIn) {
this.passphrase = passphraseIn;
}
public String getKnownHostsFilePath() {
return knownHostsFilePath;
}
public void setKnownHostsFilePath(String knownHostsFilePathIn) {
this.knownHostsFilePath = knownHostsFilePathIn;
}
public String getStrictHostKeyChecking() {
return strictHostKeyChecking;
}
public void setStrictHostKeyChecking(String strictHostKeyCheckingIn) {
this.strictHostKeyChecking = strictHostKeyCheckingIn;
}
}
| 9,117 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/OrchestratorConfiguration.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.orchestrator.core;
import java.net.URL;
import java.util.List;
/**
* This keeps configuration of orchestrator, mostly this keep static
* configuration, this can be accessed through orchestratorContext object
*/
public class OrchestratorConfiguration {
private String newJobSubmitterClass;
private String hangedJobSubmitterClass;
private int submitterInterval = 1000;
private int threadPoolSize = 10;
private boolean startSubmitter = false;
private URL brokerURL;
private boolean embeddedMode;
private List<String> validatorClasses;
private boolean enableValidation;
public List<String> getValidatorClasses() {
return validatorClasses;
}
public void setValidatorClasses(List<String> validatorClassesIn) {
this.validatorClasses = validatorClassesIn;
}
public boolean isEmbeddedMode() {
return embeddedMode;
}
public void setEmbeddedMode(boolean embeddedModeIn) {
this.embeddedMode = embeddedModeIn;
}
public URL getBrokerURL() {
return brokerURL;
}
public void setBrokerURL(URL brokerURLIn) {
this.brokerURL = brokerURLIn;
}
public String getNewJobSubmitterClass() {
return newJobSubmitterClass;
}
public int getSubmitterInterval() {
return submitterInterval;
}
public int getThreadPoolSize() {
return threadPoolSize;
}
public void setNewJobSubmitterClass(String newJobSubmitterClassIn) {
this.newJobSubmitterClass = newJobSubmitterClassIn;
}
public void setSubmitterInterval(int submitterIntervalIn) {
this.submitterInterval = submitterIntervalIn;
}
public void setThreadPoolSize(int threadPoolSizeIn) {
this.threadPoolSize = threadPoolSizeIn;
}
public boolean isStartSubmitter() {
return startSubmitter;
}
public void setStartSubmitter(boolean startSubmitterIn) {
this.startSubmitter = startSubmitterIn;
}
public String getHangedJobSubmitterClass() {
return hangedJobSubmitterClass;
}
public void setHangedJobSubmitterClass(String hangedJobSubmitterClassIn) {
this.hangedJobSubmitterClass = hangedJobSubmitterClassIn;
}
public boolean isEnableValidation() {
return enableValidation;
}
public void setEnableValidation(boolean enableValidationIn) {
this.enableValidation = enableValidationIn;
}
}
| 9,118 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorUtils.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.orchestrator.core.utils;
import java.io.IOException;
import java.util.*;
import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.ServerSettings;
import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
import org.apache.airavata.model.appcatalog.computeresource.*;
import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface;
import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission;
import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
import org.apache.airavata.model.data.movement.DataMovementInterface;
import org.apache.airavata.model.data.movement.DataMovementProtocol;
import org.apache.airavata.model.data.movement.SCPDataMovement;
import org.apache.airavata.model.data.movement.SecurityProtocol;
import org.apache.airavata.model.process.ProcessModel;
import org.apache.airavata.orchestrator.core.OrchestratorConfiguration;
import org.apache.airavata.orchestrator.core.context.OrchestratorContext;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.ApplicationInterface;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* This contains orchestrator specific utilities
*/
public class OrchestratorUtils {
private final static Logger logger = LoggerFactory.getLogger(OrchestratorUtils.class);
public static String OrchestratorStringConstant(OrchestratorConstants constant)
{
return constant.getOrchestratorStringConstant();
}
public static int OrchestratorIntegerConstant(OrchestratorConstants constant)
{
return constant.getOrchestratorIntegerConstant();
}
public static OrchestratorConfiguration loadOrchestratorConfiguration() throws OrchestratorException, IOException, NumberFormatException, ApplicationSettingsException {
OrchestratorConfiguration orchestratorConfiguration = new OrchestratorConfiguration();
orchestratorConfiguration.setSubmitterInterval(Integer.parseInt((String) ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.SUBMIT_INTERVAL))));
orchestratorConfiguration.setThreadPoolSize(Integer.parseInt((String) ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.THREAD_POOL_SIZE))));
orchestratorConfiguration.setStartSubmitter(Boolean.valueOf(ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.START_SUBMITTER))));
orchestratorConfiguration.setEmbeddedMode(Boolean.valueOf(ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.EMBEDDED_MODE))));
orchestratorConfiguration.setEnableValidation(Boolean.valueOf(ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.ENABLE_VALIDATION))));
if (orchestratorConfiguration.isEnableValidation()) {
orchestratorConfiguration.setValidatorClasses(Arrays.asList(ServerSettings.getSetting(OrchestratorStringConstant(OrchestratorConstants.JOB_VALIDATOR)).split(",")));
}
return orchestratorConfiguration;
}
public static JobSubmissionProtocol getPreferredJobSubmissionProtocol(OrchestratorContext context, ProcessModel model, String gatewayId) throws RegistryException {
try {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
String resourceHostId = model.getComputeResourceId();
ComputeResourcePreference preference = gatewayProfile.getComputeResourcePreference(gatewayId
, resourceHostId);
return preference.getPreferredJobSubmissionProtocol();
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog", e);
throw new RegistryException("Error occurred while initializing app catalog", e);
}
}
public static String getApplicationInterfaceName(OrchestratorContext context, ProcessModel model) throws RegistryException {
try {
ApplicationInterface applicationInterface = context.getRegistry().getAppCatalog().getApplicationInterface();
ApplicationInterfaceDescription appInterface = applicationInterface.getApplicationInterface(model.getApplicationInterfaceId());
return appInterface.getApplicationName();
} catch (AppCatalogException e) {
throw new RegistryException("Error while retrieving application interface", e);
}
}
public static DataMovementProtocol getPreferredDataMovementProtocol(OrchestratorContext context, ProcessModel model, String gatewayId) throws RegistryException {
try {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
String resourceHostId = model.getComputeResourceId();
ComputeResourcePreference preference = gatewayProfile.getComputeResourcePreference(gatewayId
, resourceHostId);
return preference.getPreferredDataMovementProtocol();
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog", e);
throw new RegistryException("Error occurred while initializing app catalog", e);
}
}
public static ComputeResourcePreference getComputeResourcePreference(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
String resourceHostId = processModel.getComputeResourceId();
return gatewayProfile.getComputeResourcePreference(gatewayId, resourceHostId);
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog", e);
throw new RegistryException("Error occurred while initializing app catalog", e);
}
}
public static StoragePreference getStoragePreference(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
String resourceHostId = processModel.getComputeResourceId();
return gatewayProfile.getStoragePreference(gatewayId, resourceHostId);
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog", e);
throw new RegistryException("Error occurred while initializing app catalog", e);
}
}
public static String getLoginUserName(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
String loginUserName = null;
String overrideLoginUserName = processModel.getResourceSchedule().getOverrideLoginUserName();
if (overrideLoginUserName != null && !overrideLoginUserName.equals("")) {
loginUserName = overrideLoginUserName;
} else {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
loginUserName = gatewayProfile.getComputeResourcePreference(gatewayId, processModel.getComputeResourceId()).getLoginUserName();
}
return loginUserName;
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog to fetch login username", e);
throw new RegistryException("Error occurred while initializing app catalog to fetch login username", e);
}
}
public static String getScratchLocation(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
String scratchLocation = null;
String overrideScratchLocation = processModel.getResourceSchedule().getOverrideScratchLocation();
if (overrideScratchLocation != null && !overrideScratchLocation.equals("")) {
scratchLocation = overrideScratchLocation;
} else {
GwyResourceProfile gatewayProfile = context.getRegistry().getAppCatalog().getGatewayProfile();
scratchLocation = gatewayProfile.getComputeResourcePreference(gatewayId, processModel.getComputeResourceId()).getScratchLocation();
}
return scratchLocation;
} catch (AppCatalogException e) {
logger.error("Error occurred while initializing app catalog to fetch scratch location", e);
throw new RegistryException("Error occurred while initializing app catalog to fetch scratch location", e);
}
}
public static JobSubmissionInterface getPreferredJobSubmissionInterface(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
String resourceHostId = processModel.getComputeResourceId();
ComputeResourcePreference resourcePreference = getComputeResourcePreference(context, processModel, gatewayId);
JobSubmissionProtocol preferredJobSubmissionProtocol = resourcePreference.getPreferredJobSubmissionProtocol();
ComputeResourceDescription resourceDescription = context.getRegistry().getAppCatalog().getComputeResource().getComputeResource(resourceHostId);
List<JobSubmissionInterface> jobSubmissionInterfaces = resourceDescription.getJobSubmissionInterfaces();
Map<JobSubmissionProtocol, List<JobSubmissionInterface>> orderedInterfaces = new HashMap<>();
List<JobSubmissionInterface> interfaces = new ArrayList<>();
if (jobSubmissionInterfaces != null && !jobSubmissionInterfaces.isEmpty()) {
for (JobSubmissionInterface submissionInterface : jobSubmissionInterfaces){
if (preferredJobSubmissionProtocol != null){
if (preferredJobSubmissionProtocol.toString().equals(submissionInterface.getJobSubmissionProtocol().toString())){
if (orderedInterfaces.containsKey(submissionInterface.getJobSubmissionProtocol())){
List<JobSubmissionInterface> interfaceList = orderedInterfaces.get(submissionInterface.getJobSubmissionProtocol());
interfaceList.add(submissionInterface);
}else {
interfaces.add(submissionInterface);
orderedInterfaces.put(submissionInterface.getJobSubmissionProtocol(), interfaces);
}
}
}else {
Collections.sort(jobSubmissionInterfaces, new Comparator<JobSubmissionInterface>() {
@Override
public int compare(JobSubmissionInterface jobSubmissionInterface, JobSubmissionInterface jobSubmissionInterface2) {
return jobSubmissionInterface.getPriorityOrder() - jobSubmissionInterface2.getPriorityOrder();
}
});
}
}
interfaces = orderedInterfaces.get(preferredJobSubmissionProtocol);
Collections.sort(interfaces, new Comparator<JobSubmissionInterface>() {
@Override
public int compare(JobSubmissionInterface jobSubmissionInterface, JobSubmissionInterface jobSubmissionInterface2) {
return jobSubmissionInterface.getPriorityOrder() - jobSubmissionInterface2.getPriorityOrder();
}
});
} else {
throw new RegistryException("Compute resource should have at least one job submission interface defined...");
}
return interfaces.get(0);
} catch (AppCatalogException e) {
throw new RegistryException("Error occurred while retrieving data from app catalog", e);
}
}
public static DataMovementInterface getPrefferredDataMovementInterface(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException {
try {
String resourceHostId = processModel.getComputeResourceId();
ComputeResourcePreference resourcePreference = getComputeResourcePreference(context, processModel, gatewayId);
DataMovementProtocol preferredDataMovementProtocol = resourcePreference.getPreferredDataMovementProtocol();
ComputeResourceDescription resourceDescription = context.getRegistry().getAppCatalog().getComputeResource().getComputeResource(resourceHostId);
List<DataMovementInterface> dataMovementInterfaces = resourceDescription.getDataMovementInterfaces();
if (dataMovementInterfaces != null && !dataMovementInterfaces.isEmpty()) {
for (DataMovementInterface dataMovementInterface : dataMovementInterfaces){
if (preferredDataMovementProtocol != null){
if (preferredDataMovementProtocol.toString().equals(dataMovementInterface.getDataMovementProtocol().toString())){
return dataMovementInterface;
}
}
}
} else {
throw new RegistryException("Compute resource should have at least one data movement interface defined...");
}
} catch (AppCatalogException e) {
throw new RegistryException("Error occurred while retrieving data from app catalog", e);
}
return null;
}
public static int getDataMovementPort(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException{
try {
DataMovementProtocol protocol = getPreferredDataMovementProtocol(context, processModel, gatewayId);
DataMovementInterface dataMovementInterface = getPrefferredDataMovementInterface(context, processModel, gatewayId);
if (protocol == DataMovementProtocol.SCP ) {
SCPDataMovement scpDataMovement = getSCPDataMovement(context, dataMovementInterface.getDataMovementInterfaceId());
if (scpDataMovement != null) {
return scpDataMovement.getSshPort();
}
}
} catch (RegistryException e) {
logger.error("Error occurred while retrieving security protocol", e);
}
return 0;
}
public static SecurityProtocol getSecurityProtocol(OrchestratorContext context, ProcessModel processModel, String gatewayId) throws RegistryException{
try {
JobSubmissionProtocol submissionProtocol = getPreferredJobSubmissionProtocol(context, processModel, gatewayId);
JobSubmissionInterface jobSubmissionInterface = getPreferredJobSubmissionInterface(context, processModel, gatewayId);
if (submissionProtocol == JobSubmissionProtocol.SSH ) {
SSHJobSubmission sshJobSubmission = getSSHJobSubmission(context, jobSubmissionInterface.getJobSubmissionInterfaceId());
if (sshJobSubmission != null) {
return sshJobSubmission.getSecurityProtocol();
}
} else if (submissionProtocol == JobSubmissionProtocol.LOCAL) {
LOCALSubmission localJobSubmission = getLocalJobSubmission(context, jobSubmissionInterface.getJobSubmissionInterfaceId());
if (localJobSubmission != null) {
return localJobSubmission.getSecurityProtocol();
}
} else if (submissionProtocol == JobSubmissionProtocol.SSH_FORK){
SSHJobSubmission sshJobSubmission = getSSHJobSubmission(context, jobSubmissionInterface.getJobSubmissionInterfaceId());
if (sshJobSubmission != null) {
return sshJobSubmission.getSecurityProtocol();
}
}
} catch (RegistryException e) {
logger.error("Error occurred while retrieving security protocol", e);
}
return null;
}
public static LOCALSubmission getLocalJobSubmission(OrchestratorContext context, String submissionId) throws RegistryException {
try {
AppCatalog appCatalog = context.getRegistry().getAppCatalog();
return appCatalog.getComputeResource().getLocalJobSubmission(submissionId);
} catch (Exception e) {
String errorMsg = "Error while retrieving local job submission with submission id : " + submissionId;
logger.error(errorMsg, e);
throw new RegistryException(errorMsg, e);
}
}
public static UnicoreJobSubmission getUnicoreJobSubmission(OrchestratorContext context, String submissionId) throws RegistryException {
try {
AppCatalog appCatalog = context.getRegistry().getAppCatalog();
return appCatalog.getComputeResource().getUNICOREJobSubmission(submissionId);
} catch (Exception e) {
String errorMsg = "Error while retrieving UNICORE job submission with submission id : " + submissionId;
logger.error(errorMsg, e);
throw new RegistryException(errorMsg, e);
}
}
public static SSHJobSubmission getSSHJobSubmission(OrchestratorContext context, String submissionId) throws RegistryException {
try {
AppCatalog appCatalog = context.getRegistry().getAppCatalog();
return appCatalog.getComputeResource().getSSHJobSubmission(submissionId);
} catch (Exception e) {
String errorMsg = "Error while retrieving SSH job submission with submission id : " + submissionId;
logger.error(errorMsg, e);
throw new RegistryException(errorMsg, e);
}
}
public static SCPDataMovement getSCPDataMovement(OrchestratorContext context, String dataMoveId) throws RegistryException {
try {
AppCatalog appCatalog = context.getRegistry().getAppCatalog();
return appCatalog.getComputeResource().getSCPDataMovement(dataMoveId);
} catch (Exception e) {
String errorMsg = "Error while retrieving SCP Data movement with submission id : " + dataMoveId;
logger.error(errorMsg, e);
throw new RegistryException(errorMsg, e);
}
}
}
| 9,119 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/utils/OrchestratorConstants.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.orchestrator.core.utils;
/**
* This class contains all the constants in orchestrator-core
*
*/
/*public class OrchestratorConstants {
public static final String AIRAVATA_PROPERTIES = "airavata-server.properties";
public static final int hotUpdateInterval=1000;
public static final String SUBMIT_INTERVAL = "submitter.interval";
public static final String THREAD_POOL_SIZE = "threadpool.size";
public static final String START_SUBMITTER = "start.submitter";
public static final String EMBEDDED_MODE = "embedded.mode";
public static final String ENABLE_VALIDATION = "enable.validation";
public static final String JOB_VALIDATOR = "job.validators";
}*/
/**
* This enum contains all the constants in orchestrator-core
enum is the way about dealing with constants as its very powerful.
Hence, a design change has been made to change the class to enum.
*
*/
public enum OrchestratorConstants {
AIRAVATA_PROPERTIES("airavata-server.properties"),
hotUpdateInterval(1000),
SUBMIT_INTERVAL("submitter.interval"),
THREAD_POOL_SIZE("threadpool.size"),
START_SUBMITTER("start.submitter"),
EMBEDDED_MODE("embedded.mode"),
ENABLE_VALIDATION("enable.validation"),
JOB_VALIDATOR("job.validators");
private String stringConstant;
private int integerConstant;
OrchestratorConstants(String stringConstantIn)
{
stringConstant = stringConstantIn;
}
OrchestratorConstants(int integerConstantIn)
{
integerConstant = integerConstantIn;
}
public String getOrchestratorStringConstant()
{
return stringConstant;
}
public int getOrchestratorIntegerConstant()
{
return integerConstant;
}
}
| 9,120 |
0 | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi | Create_ds/airavata-sandbox/gsoc2016/Design Changes in Airavata/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.orchestrator.cpi.impl;
import org.apache.airavata.common.utils.AiravataUtils;
import org.apache.airavata.common.utils.ThriftUtils;
import org.apache.airavata.gfac.core.task.TaskException;
import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
import org.apache.airavata.model.appcatalog.computeresource.*;
import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.application.io.DataType;
import org.apache.airavata.model.application.io.InputDataObjectType;
import org.apache.airavata.model.application.io.OutputDataObjectType;
import org.apache.airavata.model.commons.ErrorModel;
import org.apache.airavata.model.data.movement.DataMovementProtocol;
import org.apache.airavata.model.error.LaunchValidationException;
import org.apache.airavata.model.error.ValidationResults;
import org.apache.airavata.model.error.ValidatorResult;
import org.apache.airavata.model.process.ProcessModel;
import org.apache.airavata.model.experiment.*;
import org.apache.airavata.model.scheduling.ComputationalResourceSchedulingModel;
import org.apache.airavata.model.status.TaskState;
import org.apache.airavata.model.status.TaskStatus;
import org.apache.airavata.model.task.*;
import org.apache.airavata.model.util.ExperimentModelUtil;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.impl.GFACPassiveJobSubmitter;
import org.apache.airavata.orchestrator.core.job.JobSubmitter;
import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.*;
import org.apache.airavata.registry.cpi.utils.Constants;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import java.util.concurrent.ExecutorService;
public class SimpleOrchestratorImpl extends AbstractOrchestrator{
private final static Logger logger = LoggerFactory.getLogger(SimpleOrchestratorImpl.class);
private ExecutorService executor;
// this is going to be null unless the thread count is 0
private JobSubmitter jobSubmitter = null;
public SimpleOrchestratorImpl() throws OrchestratorException {
try {
try {
// We are only going to use GFacPassiveJobSubmitter
jobSubmitter = new GFACPassiveJobSubmitter();
jobSubmitter.initialize(this.orchestratorContext);
} catch (Exception e) {
String error = "Error creating JobSubmitter in non threaded mode ";
logger.error(error);
throw new OrchestratorException(error, e);
}
} catch (OrchestratorException e) {
logger.error("Error Constructing the Orchestrator");
throw e;
}
}
public boolean launchProcess(ProcessModel processModel, String tokenId) throws OrchestratorException {
try {
return jobSubmitter.submit(processModel.getExperimentId(), processModel.getProcessId(), tokenId);
} catch (Exception e) {
throw new OrchestratorException("Error launching the job", e);
}
}
public ValidationResults validateExperiment(ExperimentModel experiment) throws OrchestratorException,LaunchValidationException {
org.apache.airavata.model.error.ValidationResults validationResults = new org.apache.airavata.model.error.ValidationResults();
validationResults.setValidationState(true); // initially making it to success, if atleast one failed them simply mark it failed.
String errorMsg = "Validation Errors : ";
if (this.orchestratorConfiguration.isEnableValidation()) {
List<String> validatorClasses = this.orchestratorContext.getOrchestratorConfiguration().getValidatorClasses();
for (String validator : validatorClasses) {
try {
Class<? extends JobMetadataValidator> vClass = Class.forName(validator.trim()).asSubclass(JobMetadataValidator.class);
JobMetadataValidator jobMetadataValidator = vClass.newInstance();
validationResults = jobMetadataValidator.validate(experiment, null);
if (validationResults.isValidationState()) {
logger.info("Validation of " + validator + " is SUCCESSFUL");
} else {
List<ValidatorResult> validationResultList = validationResults.getValidationResultList();
for (ValidatorResult result : validationResultList){
if (!result.isResult()){
String validationError = result.getErrorDetails();
if (validationError != null){
errorMsg += validationError + " ";
}
}
}
logger.error("Validation of " + validator + " for experiment Id " + experiment.getExperimentId() + " is FAILED:[error]. " + errorMsg);
validationResults.setValidationState(false);
try {
ErrorModel details = new ErrorModel();
details.setActualErrorMessage(errorMsg);
details.setCreationTime(Calendar.getInstance().getTimeInMillis());
orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.EXPERIMENT_ERROR, details,
experiment.getExperimentId());
} catch (RegistryException e) {
logger.error("Error while saving error details to registry", e);
}
break;
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
} /*catch (InstantiationException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
} catch (IllegalAccessException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
}*/
}
}
if(validationResults.isValidationState()){
return validationResults;
}else {
//atleast one validation has failed, so we throw an exception
LaunchValidationException launchValidationException = new LaunchValidationException();
launchValidationException.setValidationResult(validationResults);
launchValidationException.setErrorMessage("Validation failed refer the validationResults list for detail error. Validation errors : " + errorMsg);
throw launchValidationException;
}
}
public ValidationResults validateProcess(ExperimentModel experiment, ProcessModel processModel) throws OrchestratorException,LaunchValidationException {
org.apache.airavata.model.error.ValidationResults validationResults = new org.apache.airavata.model.error.ValidationResults();
validationResults.setValidationState(true); // initially making it to success, if atleast one failed them simply mark it failed.
String errorMsg = "Validation Errors : ";
if (this.orchestratorConfiguration.isEnableValidation()) {
List<String> validatorClzzez = this.orchestratorContext.getOrchestratorConfiguration().getValidatorClasses();
for (String validator : validatorClzzez) {
try {
Class<? extends JobMetadataValidator> vClass = Class.forName(validator.trim()).asSubclass(JobMetadataValidator.class);
JobMetadataValidator jobMetadataValidator = vClass.newInstance();
validationResults = jobMetadataValidator.validate(experiment, processModel);
if (validationResults.isValidationState()) {
logger.info("Validation of " + validator + " is SUCCESSFUL");
} else {
List<ValidatorResult> validationResultList = validationResults.getValidationResultList();
for (ValidatorResult result : validationResultList){
if (!result.isResult()){
String validationError = result.getErrorDetails();
if (validationError != null){
errorMsg += validationError + " ";
}
}
}
logger.error("Validation of " + validator + " for experiment Id " + experiment.getExperimentId() + " is FAILED:[error]. " + errorMsg);
validationResults.setValidationState(false);
try {
ErrorModel details = new ErrorModel();
details.setActualErrorMessage(errorMsg);
details.setCreationTime(Calendar.getInstance().getTimeInMillis());
orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.PROCESS_ERROR, details,
processModel.getProcessId());
} catch (RegistryException e) {
logger.error("Error while saving error details to registry", e);
}
break;
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
} /*catch (InstantiationException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
} catch (IllegalAccessException e) {
logger.error("Error loading the validation class: ", validator, e);
validationResults.setValidationState(false);
}*/
}
}
if(validationResults.isValidationState()){
return validationResults;
}else {
//atleast one validation has failed, so we throw an exception
LaunchValidationException launchValidationException = new LaunchValidationException();
launchValidationException.setValidationResult(validationResults);
launchValidationException.setErrorMessage("Validation failed refer the validationResults list for detail error. Validation errors : " + errorMsg);
throw launchValidationException;
}
}
public void cancelExperiment(ExperimentModel experiment, ProcessModel processModel, String tokenId)
throws OrchestratorException {
// FIXME
// List<JobDetails> jobDetailsList = task.getJobDetailsList();
// for(JobDetails jobDetails:jobDetailsList) {
// JobState jobState = jobDetails.getJobStatus().getJobState();
// if (jobState.getValue() > 4){
// logger.error("Cannot cancel the job, because current job state is : " + jobState.toString() +
// "jobId: " + jobDetails.getJobID() + " Job Name: " + jobDetails.getJobName());
// return;
// }
// }
// jobSubmitter.terminate(experiment.getExperimentID(),task.getTaskID(),tokenId);
}
public ExecutorService getExecutor() {
return executor;
}
public void setExecutor(ExecutorService executorIn) {
this.executor = executorIn;
}
public JobSubmitter getJobSubmitter() {
return jobSubmitter;
}
public void setJobSubmitter(JobSubmitter jobSubmitterIn) {
this.jobSubmitter = jobSubmitterIn;
}
public void initialize() throws OrchestratorException {
}
public List<ProcessModel> createProcesses (String experimentId, String gatewayId) throws OrchestratorException {
List<ProcessModel> processModels = new ArrayList<ProcessModel>();
try {
Registry registry = orchestratorContext.getRegistry();
ExperimentModel experimentModel = (ExperimentModel)registry.getExperimentCatalog().get(ExperimentCatalogModelType.EXPERIMENT, experimentId);
List<Object> processList = registry.getExperimentCatalog().get(ExperimentCatalogModelType.PROCESS, Constants.FieldConstants.ExperimentConstants.EXPERIMENT_ID, experimentId);
if (processList != null && !processList.isEmpty()) {
for (Object processObject : processList) {
ProcessModel processModel = (ProcessModel)processObject;
processModels.add(processModel);
}
}else {
ProcessModel processModel = ExperimentModelUtil.cloneProcessFromExperiment(experimentModel);
String processId = (String)registry.getExperimentCatalog().add(ExpCatChildDataType.PROCESS, processModel, experimentId);
processModel.setProcessId(processId);
processModels.add(processModel);
}
} catch (Exception e) {
throw new OrchestratorException("Error during creating process");
}
return processModels;
}
public String createAndSaveTasks(String gatewayId, ProcessModel processModel, boolean autoSchedule) throws OrchestratorException {
try {
ExperimentCatalog experimentCatalog = orchestratorContext.getRegistry().getExperimentCatalog();
AppCatalog appCatalog = orchestratorContext.getRegistry().getAppCatalog();
ComputationalResourceSchedulingModel resourceSchedule = processModel.getResourceSchedule();
String userGivenQueueName = resourceSchedule.getQueueName();
int userGivenWallTime = resourceSchedule.getWallTimeLimit();
String resourceHostId = resourceSchedule.getResourceHostId();
if (resourceHostId == null){
throw new OrchestratorException("Compute Resource Id cannot be null at this point");
}
ComputeResourceDescription computeResource = appCatalog.getComputeResource().getComputeResource(resourceHostId);
JobSubmissionInterface preferredJobSubmissionInterface = OrchestratorUtils.getPreferredJobSubmissionInterface(orchestratorContext, processModel, gatewayId);
ComputeResourcePreference resourcePreference = OrchestratorUtils.getComputeResourcePreference(orchestratorContext, processModel, gatewayId);
List<String> taskIdList = new ArrayList<>();
if (resourcePreference.getPreferredJobSubmissionProtocol() == JobSubmissionProtocol.UNICORE) {
// TODO - breakdown unicore all in one task to multiple tasks, then we don't need to handle UNICORE here.
taskIdList.addAll(createAndSaveSubmissionTasks(gatewayId, preferredJobSubmissionInterface, processModel, userGivenWallTime));
} else {
taskIdList.addAll(createAndSaveEnvSetupTask(gatewayId, processModel, experimentCatalog));
taskIdList.addAll(createAndSaveInputDataStagingTasks(processModel, gatewayId));
if (autoSchedule) {
List<BatchQueue> definedBatchQueues = computeResource.getBatchQueues();
for (BatchQueue batchQueue : definedBatchQueues) {
if (batchQueue.getQueueName().equals(userGivenQueueName)) {
int maxRunTime = batchQueue.getMaxRunTime();
if (maxRunTime < userGivenWallTime) {
resourceSchedule.setWallTimeLimit(maxRunTime);
// need to create more job submissions
int numOfMaxWallTimeJobs = ((int) Math.floor(userGivenWallTime / maxRunTime));
for (int i = 1; i <= numOfMaxWallTimeJobs; i++) {
taskIdList.addAll(createAndSaveSubmissionTasks(gatewayId,preferredJobSubmissionInterface, processModel, maxRunTime));
}
int leftWallTime = userGivenWallTime % maxRunTime;
if (leftWallTime != 0) {
taskIdList.addAll(createAndSaveSubmissionTasks(gatewayId,preferredJobSubmissionInterface, processModel, leftWallTime));
}
} else {
taskIdList.addAll(createAndSaveSubmissionTasks(gatewayId,preferredJobSubmissionInterface, processModel, userGivenWallTime));
}
}
}
} else {
taskIdList.addAll(createAndSaveSubmissionTasks(gatewayId,preferredJobSubmissionInterface, processModel, userGivenWallTime));
}
taskIdList.addAll(createAndSaveOutputDataStagingTasks(processModel, gatewayId));
}
// update process scheduling
experimentCatalog.update(ExperimentCatalogModelType.PROCESS, processModel, processModel.getProcessId());
return getTaskDag(taskIdList);
} catch (Exception e) {
throw new OrchestratorException("Error during creating process");
}
}
private String getTaskDag(List<String> taskIdList) {
if (taskIdList.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
for (String s : taskIdList) {
sb.append(s).append(","); // comma separated values
}
String dag = sb.toString();
return dag.substring(0, dag.length() - 1); // remove last comma
}
private List<String> createAndSaveEnvSetupTask(String gatewayId,
ProcessModel processModel,
ExperimentCatalog experimentCatalog)
throws RegistryException, TException {
List<String> envTaskIds = new ArrayList<>();
TaskModel envSetupTask = new TaskModel();
envSetupTask.setTaskType(TaskTypes.ENV_SETUP);
envSetupTask.setTaskStatus(new TaskStatus(TaskState.CREATED));
envSetupTask.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
envSetupTask.setParentProcessId(processModel.getProcessId());
EnvironmentSetupTaskModel envSetupSubModel = new EnvironmentSetupTaskModel();
envSetupSubModel.setProtocol(OrchestratorUtils.getSecurityProtocol(orchestratorContext, processModel, gatewayId));
ComputeResourcePreference computeResourcePreference = OrchestratorUtils.getComputeResourcePreference(orchestratorContext, processModel, gatewayId);
String scratchLocation = OrchestratorUtils.getScratchLocation(orchestratorContext,processModel, gatewayId);
String workingDir = scratchLocation + File.separator + processModel.getProcessId();
envSetupSubModel.setLocation(workingDir);
byte[] envSetupSub = ThriftUtils.serializeThriftObject(envSetupSubModel);
envSetupTask.setSubTaskModel(envSetupSub);
String envSetupTaskId = (String) experimentCatalog.add(ExpCatChildDataType.TASK, envSetupTask, processModel.getProcessId());
envSetupTask.setTaskId(envSetupTaskId);
envTaskIds.add(envSetupTaskId);
return envTaskIds;
}
public List<String> createAndSaveInputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException {
List<String> dataStagingTaskIds = new ArrayList<>();
List<InputDataObjectType> processInputs = processModel.getProcessInputs();
sortByInputOrder(processInputs);
if (processInputs != null) {
for (InputDataObjectType processInput : processInputs) {
DataType type = processInput.getType();
switch (type) {
case STDERR:
break;
case STDOUT:
break;
case URI:
case URI_COLLECTION:
try {
TaskModel inputDataStagingTask = getInputDataStagingTask(processModel, processInput, gatewayId);
String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, inputDataStagingTask,
processModel.getProcessId());
inputDataStagingTask.setTaskId(taskId);
dataStagingTaskIds.add(inputDataStagingTask.getTaskId());
} catch (TException | AppCatalogException | TaskException e) {
throw new RegistryException("Error while serializing data staging sub task model");
}
break;
default:
// nothing to do
break;
}
}
}
return dataStagingTaskIds;
}
public List<String> createAndSaveOutputDataStagingTasks(ProcessModel processModel, String gatewayId) throws RegistryException {
List<String> dataStagingTaskIds = new ArrayList<>();
List<OutputDataObjectType> processOutputs = processModel.getProcessOutputs();
String appName = OrchestratorUtils.getApplicationInterfaceName(orchestratorContext, processModel);
if (processOutputs != null) {
for (OutputDataObjectType processOutput : processOutputs) {
DataType type = processOutput.getType();
switch (type) {
case STDOUT :
processOutput.setValue(appName + ".stdout");
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
case STDERR:
processOutput.setValue(appName + ".stderr");
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
case URI:
createOutputDataSatagingTasks(processModel, gatewayId, dataStagingTaskIds, processOutput);
break;
default:
// nothing to do
break;
}
}
}
try {
if (isArchive(processModel, gatewayId)) {
createArchiveDataStatgingTask(processModel, gatewayId, dataStagingTaskIds);
}
} catch (AppCatalogException e) {
throw new RegistryException("Error! Application interface retrieval failed");
}
return dataStagingTaskIds;
}
private boolean isArchive(ProcessModel processModel, String gatewayId) throws AppCatalogException {
AppCatalog appCatalog = RegistryFactory.getAppCatalog();
ApplicationInterfaceDescription appInterface = appCatalog.getApplicationInterface().getApplicationInterface(processModel.getApplicationInterfaceId());
return appInterface.isArchiveWorkingDirectory();
}
private void createArchiveDataStatgingTask(ProcessModel processModel, String gatewayId, List<String> dataStagingTaskIds) throws RegistryException {
TaskModel archiveTask = null;
try {
archiveTask = getOutputDataStagingTask(processModel, null, gatewayId);
} catch (TException e) {
throw new RegistryException("Error! DataStaging sub task serialization failed");
}
String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, archiveTask,
processModel.getProcessId());
archiveTask.setTaskId(taskId);
dataStagingTaskIds.add(archiveTask.getTaskId());
}
private void createOutputDataSatagingTasks(ProcessModel processModel, String gatewayId, List<String> dataStagingTaskIds, OutputDataObjectType processOutput) throws RegistryException {
try {
TaskModel outputDataStagingTask = getOutputDataStagingTask(processModel, processOutput, gatewayId);
String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, outputDataStagingTask,
processModel.getProcessId());
outputDataStagingTask.setTaskId(taskId);
dataStagingTaskIds.add(outputDataStagingTask.getTaskId());
} catch (TException e) {
throw new RegistryException("Error while serializing data staging sub task model", e);
}
}
private List<String> createAndSaveSubmissionTasks(String gatewayId, JobSubmissionInterface jobSubmissionInterface, ProcessModel processModel, int wallTime)
throws TException, RegistryException, OrchestratorException {
JobSubmissionProtocol jobSubmissionProtocol = jobSubmissionInterface.getJobSubmissionProtocol();
MonitorMode monitorMode = null;
if (jobSubmissionProtocol == JobSubmissionProtocol.SSH || jobSubmissionProtocol == JobSubmissionProtocol.SSH_FORK) {
SSHJobSubmission sshJobSubmission = OrchestratorUtils.getSSHJobSubmission(orchestratorContext, jobSubmissionInterface.getJobSubmissionInterfaceId());
monitorMode = sshJobSubmission.getMonitorMode();
} else if (jobSubmissionProtocol == JobSubmissionProtocol.UNICORE) {
monitorMode = MonitorMode.FORK;
} else {
logger.error("expId : {}, processId : {} :- Unsupported Job submission protocol {}.",
processModel.getExperimentId(), processModel.getProcessId(), jobSubmissionProtocol.name());
throw new OrchestratorException("Unsupported Job Submission Protocol " + jobSubmissionProtocol.name());
}
List<String> submissionTaskIds = new ArrayList<>();
TaskModel taskModel = new TaskModel();
taskModel.setParentProcessId(processModel.getProcessId());
taskModel.setCreationTime(new Date().getTime());
taskModel.setLastUpdateTime(taskModel.getCreationTime());
TaskStatus taskStatus = new TaskStatus(TaskState.CREATED);
taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
taskModel.setTaskStatus(taskStatus);
taskModel.setTaskType(TaskTypes.JOB_SUBMISSION);
JobSubmissionTaskModel submissionSubTask = new JobSubmissionTaskModel();
submissionSubTask.setMonitorMode(monitorMode);
submissionSubTask.setJobSubmissionProtocol(jobSubmissionProtocol);
submissionSubTask.setWallTime(wallTime);
byte[] bytes = ThriftUtils.serializeThriftObject(submissionSubTask);
taskModel.setSubTaskModel(bytes);
String taskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, taskModel,
processModel.getProcessId());
taskModel.setTaskId(taskId);
submissionTaskIds.add(taskModel.getTaskId());
// create monitor task for this Email based monitor mode job
if (monitorMode == MonitorMode.JOB_EMAIL_NOTIFICATION_MONITOR) {
TaskModel monitorTaskModel = new TaskModel();
monitorTaskModel.setParentProcessId(processModel.getProcessId());
monitorTaskModel.setCreationTime(new Date().getTime());
monitorTaskModel.setLastUpdateTime(monitorTaskModel.getCreationTime());
TaskStatus monitorTaskStatus = new TaskStatus(TaskState.CREATED);
monitorTaskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
monitorTaskModel.setTaskStatus(monitorTaskStatus);
monitorTaskModel.setTaskType(TaskTypes.MONITORING);
MonitorTaskModel monitorSubTaskModel = new MonitorTaskModel();
monitorSubTaskModel.setMonitorMode(monitorMode);
monitorTaskModel.setSubTaskModel(ThriftUtils.serializeThriftObject(monitorSubTaskModel));
String mTaskId = (String) orchestratorContext.getRegistry().getExperimentCatalog().add(ExpCatChildDataType.TASK, monitorTaskModel, processModel.getProcessId());
monitorTaskModel.setTaskId(mTaskId);
submissionTaskIds.add(monitorTaskModel.getTaskId());
}
return submissionTaskIds;
}
private void sortByInputOrder(List<InputDataObjectType> processInputs) {
Collections.sort(processInputs, new Comparator<InputDataObjectType>() {
@Override
public int compare(InputDataObjectType inputDT_1, InputDataObjectType inputDT_2) {
return inputDT_1.getInputOrder() - inputDT_2.getInputOrder();
}
});
}
private TaskModel getInputDataStagingTask(ProcessModel processModel, InputDataObjectType processInput, String gatewayId) throws RegistryException, TException, AppCatalogException, TaskException {
// create new task model for this task
TaskModel taskModel = new TaskModel();
taskModel.setParentProcessId(processModel.getProcessId());
taskModel.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
taskModel.setLastUpdateTime(taskModel.getCreationTime());
TaskStatus taskStatus = new TaskStatus(TaskState.CREATED);
taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
taskModel.setTaskStatus(taskStatus);
taskModel.setTaskType(TaskTypes.DATA_STAGING);
// create data staging sub task model
DataStagingTaskModel submodel = new DataStagingTaskModel();
ComputeResourcePreference computeResourcePreference = OrchestratorUtils.getComputeResourcePreference(orchestratorContext, processModel, gatewayId);
ComputeResourceDescription computeResource = orchestratorContext.getRegistry().getAppCatalog().getComputeResource().getComputeResource(processModel.getComputeResourceId());
String remoteOutputDir = OrchestratorUtils.getScratchLocation(orchestratorContext,processModel, gatewayId) + File.separator + processModel.getProcessId();
remoteOutputDir = remoteOutputDir.endsWith("/") ? remoteOutputDir : remoteOutputDir + "/";
URI destination = null;
try {
DataMovementProtocol dataMovementProtocol = OrchestratorUtils.getPreferredDataMovementProtocol(orchestratorContext, processModel, gatewayId);
String loginUserName = OrchestratorUtils.getLoginUserName(orchestratorContext, processModel, gatewayId);
destination = new URI(dataMovementProtocol.name(),
loginUserName,
computeResource.getHostName(),
OrchestratorUtils.getDataMovementPort(orchestratorContext, processModel, gatewayId),
remoteOutputDir , null, null);
} catch (URISyntaxException e) {
throw new TaskException("Error while constructing destination file URI");
}
submodel.setType(DataStageType.INPUT);
submodel.setSource(processInput.getValue());
submodel.setProcessInput(processInput);
submodel.setDestination(destination.toString());
taskModel.setSubTaskModel(ThriftUtils.serializeThriftObject(submodel));
return taskModel;
}
private TaskModel getOutputDataStagingTask(ProcessModel processModel, OutputDataObjectType processOutput, String gatewayId) throws RegistryException, TException {
try {
// create new task model for this task
TaskModel taskModel = new TaskModel();
taskModel.setParentProcessId(processModel.getProcessId());
taskModel.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
taskModel.setLastUpdateTime(taskModel.getCreationTime());
TaskStatus taskStatus = new TaskStatus(TaskState.CREATED);
taskStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
taskModel.setTaskStatus(taskStatus);
taskModel.setTaskType(TaskTypes.DATA_STAGING);
ComputeResourcePreference computeResourcePreference = OrchestratorUtils.getComputeResourcePreference(orchestratorContext, processModel, gatewayId);
ComputeResourceDescription computeResource = orchestratorContext.getRegistry().getAppCatalog().getComputeResource().getComputeResource(processModel.getComputeResourceId());
String remoteOutputDir = OrchestratorUtils.getScratchLocation(orchestratorContext,processModel, gatewayId) + File.separator + processModel.getProcessId();
remoteOutputDir = remoteOutputDir.endsWith("/") ? remoteOutputDir : remoteOutputDir + "/";
DataStagingTaskModel submodel = new DataStagingTaskModel();
DataMovementProtocol dataMovementProtocol = OrchestratorUtils.getPreferredDataMovementProtocol(orchestratorContext, processModel, gatewayId);
URI source = null;
try {
String loginUserName = OrchestratorUtils.getLoginUserName(orchestratorContext, processModel, gatewayId);
if (processOutput != null) {
submodel.setType(DataStageType.OUPUT);
submodel.setProcessOutput(processOutput);
source = new URI(dataMovementProtocol.name(),
loginUserName,
computeResource.getHostName(),
OrchestratorUtils.getDataMovementPort(orchestratorContext, processModel, gatewayId),
remoteOutputDir + processOutput.getValue(), null, null);
} else {
// archive
submodel.setType(DataStageType.ARCHIVE_OUTPUT);
source = new URI(dataMovementProtocol.name(),
loginUserName,
computeResource.getHostName(),
OrchestratorUtils.getDataMovementPort(orchestratorContext, processModel, gatewayId),
remoteOutputDir, null, null);
}
} catch (URISyntaxException e) {
throw new TaskException("Error while constructing source file URI");
}
// We don't know destination location at this time, data staging task will set this.
// because destination is required field we set dummy destination
submodel.setSource(source.toString());
// We don't know destination location at this time, data staging task will set this.
// because destination is required field we set dummy destination
submodel.setDestination("dummy://temp/file/location");
taskModel.setSubTaskModel(ThriftUtils.serializeThriftObject(submodel));
return taskModel;
} catch (AppCatalogException | TaskException e) {
throw new RegistryException("Error occurred while retrieving data movement from app catalog", e);
}
}
}
| 9,121 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/auroraClient/AuroraJobSchedulerImpl.java | package org.apache.airavata.cloud.aurora.auroraClient;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
import org.apache.airavata.cloud.aurora.utilities.AuroraUtilImpl;
import org.apache.airavata.cloud.aurora.utilities.AuroraUtilI;
public class AuroraJobSchedulerImpl implements AuroraJobSchedulerI {
AuroraUtilI util = new AuroraUtilImpl();
public void openWebUI(String key) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job open "+key);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while opening the browser.\n"+ex.toString());
}
}
public void clusterQuota(String key) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora quota get "+key);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the production quota of the cluster.\n"+ex.toString());
}
}
public void jobInspect(String key, String config) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job inspect "+key+" "+config);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while inspecting the job.\n"+ex.toString());
}
}
public void configList(String config) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora config list "+config);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the list of jobs.\n"+ex.toString());
}
}
public void jobDiff(String key, String config) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job diff "+key+" "+config);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the job difference.\n"+ex.toString());
}
}
public void auroraJobCommand(String info, String command) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora task run example/benchmarks/devel/"+info+" "+command);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while passing the command.\n"+ex.toString());
}
}
public void jobUpdateList(String info) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora update list example/benchmarks/devel/"+info);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while listing the update.\n"+ex.toString());
}
}
public void jobUpdateAbort(String info) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora abort pause example/benchmarks/devel/"+info);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while aborting the update.\n"+ex.toString());
}
}
public void jobUpdateResume(String info) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora update resume example/benchmarks/devel/"+info);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while resuming the update.\n"+ex.toString());
}
}
public void jobUpdatePause(String info) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora update pause example/benchmarks/devel/"+info);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while pausing the update.\n"+ex.toString());
}
}
public void jobUpdateInfo(String info) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora update info example/benchmarks/devel/"+info);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while retrieving the update info."+ex.toString());
}
}
public void jobUpdate(String update) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora update start example/benchmarks/devel/"+update+" "+update+".aurora");
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while updating the job.\n"+ex.toString());
}
}
public void jobRestart(String restart) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job restart example/benchmarks/devel/"+restart);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while restarting the job.\n"+ex.toString());
}
}
public void jobKill(String kill) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job killall example/benchmarks/devel/"+kill);
auroraJob.waitFor();
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
}
catch (Exception ex) {
throw new AuroraException("Exception occured while killing the job.\n"+ex.toString());
}
}
public void jobLaunch(String name) throws AuroraException{
try{
String line;
Process auroraJob = Runtime.getRuntime().exec("aurora job create example/benchmarks/devel/"+name+" "+name+".aurora");
BufferedReader stdout = new BufferedReader(new InputStreamReader(auroraJob.getInputStream()));
util.printLog(stdout);
auroraJob.waitFor();
}
catch (Exception ex) {
throw new AuroraException("Exception occured while launching the job.\n"+ex.toString());
}
}
public void configCreate(String name, String ram, String cpu, String disk, String image) throws AuroraException{
try {
String config = "import hashlib\n"+name+"= Process(name = '"+name+"', cmdline = 'java -jar /dacapo-9.12-bach.jar "+name+" -s small')\n"+name+"_task = SequentialTask(processes = [ "+name+"], resources = Resources(cpu = "+cpu+", ram = "+ram+"*MB, disk="+disk+"*MB))\njobs = [ Job(cluster = 'example', environment = 'devel', role = 'benchmarks', name = '"+name+"', task = "+name+"_task, instances =1 , container = Container(docker = Docker(image = '"+image+"')))]\n";
File file = new File(name+".aurora");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(config);
bw.close();
}catch (IOException ex) {
throw new AuroraException("IO Exception occured while creating the configuration file.\n"+ex.toString());
}catch (Exception ex) {
throw new AuroraException("Exception occured while creating the configuration file.\n"+ex.toString());
}
}
}
| 9,122 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/auroraClient/AuroraJobSchedulerI.java | package org.apache.airavata.cloud.aurora.auroraClient;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
public interface AuroraJobSchedulerI {
public void jobUpdateInfo(String info) throws AuroraException;
public void jobUpdate(String update) throws AuroraException;
public void jobUpdateResume(String info) throws AuroraException;
public void jobUpdateAbort(String info) throws AuroraException;
public void jobUpdateList(String info) throws AuroraException;
public void jobUpdatePause(String info) throws AuroraException;
public void auroraJobCommand(String info, String command) throws AuroraException;
public void jobRestart(String restart) throws AuroraException;
public void jobKill(String kill) throws AuroraException;
public void jobLaunch(String name) throws AuroraException;
public void jobDiff(String key, String config) throws AuroraException;
public void jobInspect(String key, String config) throws AuroraException;
public void clusterQuota(String key) throws AuroraException;
public void configList(String config) throws AuroraException;
public void openWebUI(String key) throws AuroraException;
public void configCreate(String name, String ram, String cpu, String disk, String image) throws AuroraException;
}
| 9,123 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/driver/AuroraAdminDriver.java | package org.apache.airavata.cloud.aurora.driver;
// TODO: need javadoc documentation at the top of each method
// TODO: individually import the types
import java.util.*;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
import org.apache.airavata.cloud.aurora.auroraClient.AuroraJobSchedulerI;
import org.apache.airavata.cloud.aurora.auroraClient.AuroraJobSchedulerImpl;
import org.apache.airavata.cloud.aurora.bigDataInjections.AuroraInjectorImpl;
import org.apache.airavata.cloud.aurora.bigDataInjections.BigDataInjectorI;
public class AuroraAdminDriver{
public static void main(String[] args) {
// TODO: do command line validation
// Processing of the command line arguments should be moved to a different method
// This code to add command line arguments is based on Apache Commons
// TODO: explain why this Map data structure is needed
Map<String, List<String>> params = new HashMap<>();
// TODO: explain what is the purpose of this List
List<String> options = null;
for (int i = 0; i < args.length; i++) {
final String a = args[i];
if (a.charAt(0) == '-') {
if (a.length() < 2) {
// TOOD: need more details in the error statement
System.err.println("Error at argument " + a);
return;
}
// TODO: explain the purpose of this ArrayList
options = new ArrayList<>();
params.put(a.substring(1), options);
}
// TODO: explain when this "else" branch is taken
else if (options != null) {
options.add(a);
}
else {
System.err.println("Illegal parameter \n[USAGE]\nOptions:\n1) -o\tcreate, kill, restart, update, update-info, update-pause\n2) -n\tname of the job\n 3) -r\tamount of RAM\n 4) -c\tCPU count\n 5) -d\tdisk space\n 6) -k\tname of the task to be killed\n 7) -i\texecutable/image\n ");
return;
}
}// end of for (int i=0; ...
// use the code below to decide between injecting Aurora, Marathon, etc. as injections
AuroraJobSchedulerI auroraJS = new AuroraJobSchedulerImpl();
BigDataInjectorI auroraInjector = new AuroraInjectorImpl(auroraJS);
auroraInjector.executeTheBigDataClientSideCommand(params);
} // end of public static void main
} // end of class
| 9,124 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/utilities/AuroraUtilImpl.java |
package org.apache.airavata.cloud.aurora.utilities;
import java.io.BufferedReader;
import java.io.IOException;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
public class AuroraUtilImpl implements AuroraUtilI{
public void printLog(BufferedReader stdout) throws AuroraException
{
try{
String line;
line = stdout.readLine();
while (line != null) {
System.out.println(line);
line = stdout.readLine();
}
}
catch (IOException ex) {
throw new AuroraException("IO Exception occured while passing the command.\n"+ex.toString());
}
}
}
| 9,125 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/utilities/AuroraUtilI.java | package org.apache.airavata.cloud.aurora.utilities;
import java.io.BufferedReader;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
public interface AuroraUtilI{
public void printLog(BufferedReader stdout) throws AuroraException;
}
| 9,126 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/bigDataInjections/AuroraInjectorImpl.java |
package org.apache.airavata.cloud.aurora.bigDataInjections;
import java.util.Map;
import java.util.List;
import org.apache.airavata.cloud.aurora.auroraClient.AuroraJobSchedulerI;
import org.apache.airavata.cloud.aurora.auroraClient.AuroraJobSchedulerImpl;
import org.apache.airavata.cloud.aurora.exception.AuroraException;
public class AuroraInjectorImpl implements BigDataInjectorI {
private AuroraJobSchedulerI auroraJS = null;
public AuroraInjectorImpl(AuroraJobSchedulerI auroraJSIn) {
auroraJS = auroraJSIn;
}
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions) {
String commandName = commandLineOptions.get("o").get(0);
String RamSize, JobName, CpuCount, DiskSize, Image;
switch(commandName)
{
case "kill" :
try {
auroraJS.jobKill(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "restart" :
try {
auroraJS.jobRestart(commandLineOptions.get("n").get(0));
} catch (AuroraException ex) {
} break;
case "update" :
try {
auroraJS.jobUpdate(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "update-info" :
try {
auroraJS.jobUpdateInfo(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "update-pause" :
try {
auroraJS.jobUpdatePause(commandLineOptions.get("n").get(0));
} catch(AuroraException ex){
} break;
case "inspect" :
try {
auroraJS.jobInspect(commandLineOptions.get("n").get(0), commandLineOptions.get("k").get(0));
} catch(AuroraException ex){
} break;
case "quota" :
try {
auroraJS.clusterQuota(commandLineOptions.get("k").get(0));
} catch(AuroraException ex){
} break;
case "create" :
JobName = commandLineOptions.get("n").get(0);
RamSize = commandLineOptions.get("r").get(0);
CpuCount = commandLineOptions.get("c").get(0);
DiskSize = commandLineOptions.get("d").get(0);
Image = commandLineOptions.get("i").get(0);
try {
auroraJS.configCreate(JobName,RamSize,CpuCount,DiskSize,Image);
} catch (AuroraException ex) {}
try {
auroraJS.jobLaunch(JobName);
} catch (AuroraException ex) {
} break;
default :
System.out.println("Improper option\nOptions available:\n1) create\n2) kill\n3) restart\n4) update\n 5) update-info\n6) update-pause\n");
}
} // end of public void executeTheBigDataCommand
} // end of public class AuroraInjectorImpl
| 9,127 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/bigDataInjections/BigDataInjectorI.java |
package org.apache.airavata.cloud.aurora.bigDataInjections;
import java.util.Map;
import java.util.List;
public interface BigDataInjectorI {
// TODO: this interface should throw an exception
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions);
}
| 9,128 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/AuroraIntegration/src/org/apache/airavata/cloud/aurora/exception/AuroraException.java | package org.apache.airavata.cloud.aurora.exception;
public class AuroraException extends Exception {
private String exceptionMsg;
public AuroraException(){
exceptionMsg="";
}
public AuroraException(String exceptionMsgIn){
exceptionMsg=exceptionMsgIn;;
}
public String toString(){
return this.exceptionMsg;
}
}
| 9,129 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/marathonClient/MarathonJobSchedulerImpl.java | package org.apache.airavata.cloud.marathon.marathonClient;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
import org.apache.airavata.cloud.marathon.utilities.MarathonUtilImpl;
import org.apache.airavata.cloud.marathon.utilities.MarathonUtilI;
public class MarathonJobSchedulerImpl implements MarathonJobSchedulerI {
MarathonUtilI util = new MarathonUtilImpl();
public void deleteMarathonLeader(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X DELETE "+address+"/v2/leader");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the launch queue.\n"+ex.toString());
}
}
public void marathonLeader(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/leader");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the leader information.\n"+ex.toString());
}
}
public void marathonInfo(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/info");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the marathon information.\n"+ex.toString());
}
}
public void launchQueue(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/queue");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the launch queue.\n"+ex.toString());
}
}
public void eventSubscriptionList(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/eventSubscriptions");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of event subscriptions.\n"+ex.toString());
}
}
public void eventsList(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/events");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of events.\n"+ex.toString());
}
}
public void deleteDeployment(String address, String id) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X DELETE "+address+"/v2/deployments/"+id);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while deleting the deployment.\n"+ex.toString());
}
}
public void deploymentList(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/deployments");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of deployment.\n"+ex.toString());
}
}
public void deleteGroups(String address, String id) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X DELETE "+address+"/v2/groups/"+id);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while deleting the group.\n"+ex.toString());
}
}
public void createGroups(String address, String json) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X POST -H \"Content-type: application/json\" "+address+"/v2/groups/"+json);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while creating the group.\n"+ex.toString());
}
}
public void groups(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/groups/");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of groups.\n"+ex.toString());
}
}
public void groupsId(String address, String groupid) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/groups/"+groupid);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list of groups.\n"+ex.toString());
}
}
public void jobDeleteId(String address, String appid, String taskid) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl DELETE "+address+"/v2/apps/"+appid+"/"+taskid);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobDelete(String address, String appid) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl DELETE "+address+"/v2/apps/"+appid+"/tasks");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void runningJobs(String address, String appid) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/apps/"+appid+"/tasks");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobListById(String address, String id) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/apps/"+id);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobListByName(String address, String name) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/apps/"+name);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobList(String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl GET "+address+"/v2/apps");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while retrieving the list jobs.\n"+ex.toString());
}
}
public void jobKill(String name, String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X DELETE "+address+""+name);
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while killing the job.\n"+ex.toString());
}
}
public void jobLaunch(String name, String address) throws MarathonException{
try{
String line;
Process marathonJob = Runtime.getRuntime().exec("curl -X POST "+address+"/v2/apps -d @"+name+" -H Content-type: application/json");
BufferedReader stdout = new BufferedReader(new InputStreamReader(marathonJob.getInputStream()));
util.printLog(stdout);
marathonJob.waitFor();
}
catch (Exception ex) {
throw new MarathonException("Exception occured while launching the job.\n"+ex.toString());
}
}
public void configCreate(String name, String ram, String cpu, String disk, String image, String command) throws MarathonException{
try {
String config = "'id': "+name+",'cmd': \""+command+"\", \"container\": {\"type\": \"DOCKER\", \"docker\": {\"image\": \""+image+"\", \"forcePullImage\": bool(1)}},\"constraints\":[[\"hostname\",\"UNIQUE\"]],\"cpus\": float("+cpu+"), \"mem\": "+ram+"), \"disk\": "+disk+", \"instances\": 1";
File file = new File(name+".json");
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
bw.write(config);
bw.close();
}catch (IOException ex) {
throw new MarathonException("IO Exception occured while creating the configuration file.\n"+ex.toString());
}catch (Exception ex) {
throw new MarathonException("Exception occured while creating the configuration file.\n"+ex.toString());
}
}
}
| 9,130 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/marathonClient/MarathonJobSchedulerI.java | package org.apache.airavata.cloud.marathon.marathonClient;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
public interface MarathonJobSchedulerI {
public void deleteMarathonLeader(String address) throws MarathonException;
public void marathonLeader(String address) throws MarathonException;
public void marathonInfo(String address) throws MarathonException;
public void launchQueue(String address) throws MarathonException;
public void eventSubscriptionList(String address) throws MarathonException;
public void eventsList(String address) throws MarathonException;
public void deleteDeployment(String address, String id) throws MarathonException;
public void deploymentList(String address) throws MarathonException;
public void deleteGroups(String address, String id) throws MarathonException;
public void createGroups(String address, String json) throws MarathonException;
public void groups(String address) throws MarathonException;
public void groupsId(String address, String groupid) throws MarathonException;
public void jobDeleteId(String address, String appid, String taskid) throws MarathonException;
public void jobDelete(String address, String appid) throws MarathonException;
public void runningJobs(String address, String appid) throws MarathonException;
public void jobListById(String address, String id) throws MarathonException;
public void jobListByName(String address, String name) throws MarathonException;
public void jobList(String address) throws MarathonException;
public void jobKill(String kill, String address) throws MarathonException;
public void jobLaunch(String name, String address) throws MarathonException;
public void configCreate(String name, String ram, String cpu, String disk, String image, String command) throws MarathonException;
}
| 9,131 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/driver/MarathonAdminDriver.java | package org.apache.airavata.cloud.marathon.driver;
// TODO: need javadoc documentation at the top of each method
// TODO: individually import the types
import java.util.*;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
import org.apache.airavata.cloud.marathon.marathonClient.MarathonJobSchedulerImpl;
import org.apache.airavata.cloud.marathon.marathonClient.MarathonJobSchedulerI;
import org.apache.airavata.cloud.marathon.bigDataInjections.MarathonInjectorImpl;
import org.apache.airavata.cloud.marathon.bigDataInjections.BigDataInjectorI;
public class MarathonAdminDriver{
public static void main(String[] args) {
// TODO: do command line validation
// Processing of the command line arguments should be moved to a different method
// This code to add command line arguments is based on Apache Commons
// TODO: explain why this Map data structure is needed
Map<String, List<String>> params = new HashMap<>();
// TODO: explain what is the purpose of this List
List<String> options = null;
for (int i = 0; i < args.length; i++) {
final String a = args[i];
if (a.charAt(0) == '-') {
if (a.length() < 2) {
// TOOD: need more details in the error statement
System.err.println("Error at argument " + a);
return;
}
// TODO: explain the purpose of this ArrayList
options = new ArrayList<>();
params.put(a.substring(1), options);
}
// TODO: explain when this "else" branch is taken
else if (options != null) {
options.add(a);
}
else {
System.err.println("Illegal parameter \n[USAGE]\nOptions:\n1) -o\tcreate, kill, restart, update, update-info, update-pause\n2) -n\tname of the job\n 3) -r\tamount of RAM\n 4) -c\tCPU count\n 5) -d\tdisk space\n 6) -k\tname of the task to be killed\n 7) -i\texecutable/image\n ");
return;
}
}// end of for (int i=0; ...
MarathonJobSchedulerI marathonJS = new MarathonJobSchedulerImpl();
BigDataInjectorI marathonInjector = new MarathonInjectorImpl(marathonJS);
marathonInjector.executeTheBigDataClientSideCommand(params);
} // end of public static void main
} // end of class
| 9,132 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/utilities/MarathonUtilI.java | package org.apache.airavata.cloud.marathon.utilities;
import java.io.BufferedReader;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
public interface MarathonUtilI{
public void printLog(BufferedReader stdout) throws MarathonException;
}
| 9,133 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/utilities/MarathonUtilImpl.java |
package org.apache.airavata.cloud.marathon.utilities;
import java.io.BufferedReader;
import java.io.IOException;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
public class MarathonUtilImpl implements MarathonUtilI{
public void printLog(BufferedReader stdout) throws MarathonException
{
try{
String line;
line = stdout.readLine();
while (line != null) {
System.out.println(line);
line = stdout.readLine();
}
}
catch (IOException ex) {
throw new MarathonException("IO Exception occured while passing the command.\n"+ex.toString());
}
}
}
| 9,134 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/bigDataInjections/MarathonInjectorImpl.java |
package org.apache.airavata.cloud.marathon.bigDataInjections;
import java.util.Map;
import java.util.List;
import org.apache.airavata.cloud.marathon.marathonClient.MarathonJobSchedulerI;
import org.apache.airavata.cloud.marathon.marathonClient.MarathonJobSchedulerImpl;
import org.apache.airavata.cloud.marathon.exception.MarathonException;
public class MarathonInjectorImpl implements BigDataInjectorI {
private MarathonJobSchedulerI marathonJS = null;
public MarathonInjectorImpl(MarathonJobSchedulerI marathonJSIn) {
marathonJS = marathonJSIn;
}
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions) {
String commandName = commandLineOptions.get("o").get(0);
String RamSize, JobName, CpuCount, DiskSize, Image, Command;
switch(commandName)
{
case "kill" :
try {
marathonJS.jobKill(commandLineOptions.get("n").get(0),commandLineOptions.get("a").get(0));
} catch(MarathonException ex){
} break;
case "create" :
JobName = commandLineOptions.get("n").get(0);
RamSize = commandLineOptions.get("r").get(0);
CpuCount = commandLineOptions.get("c").get(0);
DiskSize = commandLineOptions.get("d").get(0);
Image = commandLineOptions.get("i").get(0);
Command = commandLineOptions.get("a").get(0);
try {
marathonJS.configCreate(JobName,RamSize,CpuCount,DiskSize,Image, Command);
} catch (MarathonException ex) {}
try {
marathonJS.jobLaunch(JobName,commandLineOptions.get("a").get(0));
} catch (MarathonException ex) {
} break;
default :
System.out.println("Improper option\nOptions available:\n1) create\n2) kill\n");
}
} // end of public void executeTheBigDataCommand
} // end of public class AuroraInjectorImpl
| 9,135 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/bigDataInjections/BigDataInjectorI.java |
package org.apache.airavata.cloud.marathon.bigDataInjections;
import java.util.Map;
import java.util.List;
public interface BigDataInjectorI {
// TODO: this interface should throw an exception
public void executeTheBigDataClientSideCommand(Map<String, List<String>> commandLineOptions);
}
| 9,136 |
0 | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon | Create_ds/airavata-sandbox/gsoc2016/Big-Data-Integration/MarathonIntegration/src/org/apache/airavata/cloud/marathon/exception/MarathonException.java | package org.apache.airavata.cloud.marathon.exception;
public class MarathonException extends Exception {
private String exceptionMsg;
public MarathonException(){
exceptionMsg="";
}
public MarathonException(String exceptionMsgIn){
exceptionMsg=exceptionMsgIn;;
}
public String toString(){
return this.exceptionMsg;
}
}
| 9,137 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/AbstractGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.log4j.Logger;
import org.junit.Before;
import java.util.Properties;
public abstract class AbstractGridChemParserTest {
protected Properties testProperties;
protected String TEST_OUTPUT;
private Logger logger = Logger.getLogger(AbstractGridChemParserTest.class);
@Before
public void setUp() {
TEST_OUTPUT = GridChemProperties.getInstance().getProperty(Constants.SAMPLE_OUTPUT,"");
}
} | 9,138 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/GridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem;
import junit.framework.Assert;
import org.apache.airavata.datacat.models.OutputMetadataDTO;
import org.apache.airavata.datacat.models.OutputMonitorMessage;
import org.apache.airavata.datacat.models.OutputMonitorMessageType;
import org.apache.airavata.datacat.parsers.gridchem.GridChemParser;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
public class GridChemParserTest {
private Logger log = Logger.getLogger(GridChemParserTest.class);
private String SAMPLE_DATA;
private OutputMonitorMessage outputMonitorMessage;
private GridChemParser parser;
@Before
public void setup() {
//configuring the data root
SAMPLE_DATA = GridChemProperties.getInstance().getProperty(Constants.SAMPLE_OUTPUT, "");
parser = new GridChemParser();
outputMonitorMessage = new OutputMonitorMessage();
//creating a dummy file monitor message
outputMonitorMessage.setExperimentName("2H2OOHNCmin.com.out");
outputMonitorMessage.setOutputPath(SAMPLE_DATA);
outputMonitorMessage.setFileMonitorMessageType(OutputMonitorMessageType.FILE_CREATED);
log.info("File Monitor message initialized ...");
}
@Test
public void testGCParserSingleOutput() {
OutputMetadataDTO metadataDTO = parser.parse(outputMonitorMessage);
Assert.assertNotNull(metadataDTO);
}
}
| 9,139 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/ParserParameterizedTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.B3PW91.B3PW91Parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import org.apache.airavata.datacat.parsers.gridchem.cbsQ.CbsQParser;
import org.apache.airavata.datacat.parsers.gridchem.finalcoord.FinalCoordParser;
import org.apache.airavata.datacat.parsers.gridchem.g1.G1Parser;
import org.apache.airavata.datacat.parsers.gridchem.gaussian.GaussianParser;
import org.apache.airavata.datacat.parsers.gridchem.gfinalcoord.GFinalCoordParser;
import org.apache.airavata.datacat.parsers.gridchem.gmcscfa.GmcscfaParser;
import org.apache.airavata.datacat.parsers.gridchem.gnumatom.GNumAtomParser;
import org.apache.airavata.datacat.parsers.gridchem.gopt.GoptParser;
import org.apache.airavata.datacat.parsers.gridchem.gscfa.GscfaParser;
import org.apache.airavata.datacat.parsers.gridchem.gvb.GVBParser;
import org.apache.airavata.datacat.parsers.gridchem.input.InputParser;
import org.apache.airavata.datacat.parsers.gridchem.method.MethodParser;
import org.apache.airavata.datacat.parsers.gridchem.mfinalcoord.MFinalCoordParser;
import org.apache.airavata.datacat.parsers.gridchem.mopta.MOptaParser;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5a.MP2to5aParser;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5b.MP2to5bParser;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5c.MP2to5cParser;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5d.MP2to5dParser;
import org.apache.airavata.datacat.parsers.gridchem.scfa.SCFaParser;
import org.apache.airavata.datacat.parsers.gridchem.scfb.SCFbParser;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
@RunWith(Parameterized.class)
public class ParserParameterizedTest {
private Logger log = Logger.getLogger(ParserParameterizedTest.class);
private String filename;
private boolean expected;
private GridChemQueueParser parser;
private String OUTPUT_FILE_PATH;
@Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{"2H2OOHNCmin.com.out", true},
{"2H2OOHNCtsb.com.out", true},
{"2H2OOHNCtsc.com.out", true},
{"2H2OOHNCtsd.com.out", true},
{"2H2OOHNCtse.com.out", true},
{"2H2OOHNCtsf.com.out", true},
{"A1MBBTSNTd.com.out",true},
{"A1MBBTSNTe.com.out",true},
{"AcArgTS1.com.out",true},
{"AcArgTS1a.com.out",true},
{"AcArgTS1mi.com.out",true},
{"AcArgTS2.com.out",true},
{"AcArTS1mia.com.out",true},
{"acetbvTS1.com.out",true},
{"acetbvTS1a.com.out",true},
{"acet_bvTSa.com.out",true},
{"acetbvTSHM.com.out",true},
{"acetbvTSHM1.com.out",true},
{"acetHGS.com.out",true},
{"acetHTS1.com.out",true},
{"acetHTS1IR.com.out",true},
{"acetHTS1IRR.com.out",true},
{"acetHTS2.com.out",true},
{"acettetTS.com.out",true},
{"acettetTSa.com.out",true},
{"acettetTSM.com.out",true},
{"acettetTSM1.com.out",true},
{"acetTS1Ha.com.out",true},
{"acetTSaIRCF.com.out",true},
{"AchextetB.com.out",true},
{"AcOHOHTS.com.out",true},
{"AcOHOHTS1.com.out",true},
{"AcPhCHtetB.com.out",true},
{"ActethexA.com.out",true},
{"ActetPhA.com.out",true},
{"BalvTSIRCF.com.out",true},
{"BalvTSIRCR.com.out",true},
{"CH3oohGS.com.out",true},
{"CH3oohtet.com.out",true},
{"CH3oohTS1.com.out",true},
{"CH3oohTS1a.com.out",true},
{"CH4_311.com.out",true},
{"cycAGS1.com.out",true},
{"cycATS1.com.out",true},
{"cycAGS1.com.out",true},
{"cycBTS1.com.out",true},
{"FL_acOHts4.com.out",true},
{"FLarcyctsF.com.out",true},
{"FLox31_311.com.out",true},
{"H2O_OHNaCl.com.out",true},
{"H2OOHNaClts.com.out",true},
{"H2OOHNCltsa.com.out",true},
{"H2OOHNCltsb.com.out",true},
{"H2OOHNCltsc.com.out",true},
{"H2O_OHrad.com.out",true},
{"H2O_OHradN.com.out",true},
{"H2OOHradNts.com.out",true},
{"H2O_OHradts.com.out",true},
{"H3O_ONaCl.com.out",true},
{"IQOOGSMeOH.com.out",true},
{"IQOOGSMeOHa.com.out",true},
{"IQOOGSMeOHb.com.out",true},
{"IQOOH.com.out",true},
{"IQOOHBcIRCF.com.out",true},
{"IQOOHBcIRCR.com.out",true},
{"IQOOHBGIRCF.com.out",true},
{"IQOOHBGIRCR.com.out",true},
{"IQOOHimts.com.out",true},
{"IQOOHimtsa.com.out",true},
{"IQOOHimtsb.com.out",true},
{"IQOOHIRCF.com.out",true},
{"IQOOHIRCF6.com.out",true},
{"IQOOHIRCFa.com.out",true},
{"IQOOHIRCFre.com.out",true},
{"IQOOHIRCR.com.out",true},
{"IQOOHIRCR6.com.out",true},
{"IQOOHNHCOOH.com.out",true},
{"IQOOHNHIRCF.com.out",true},
{"IQOOHNHIRCR.com.out",true},
{"IQOOHNmin.com.out",true},
{"IQOOHNmin90.com.out",true},
{"IQOOHNminUF.com.out",true},
{"IQOOHNts.com.out",true}
});
}
public ParserParameterizedTest(String filename, boolean expected) {
OUTPUT_FILE_PATH = GridChemProperties.getInstance().getProperty(Constants.SAMPLE_OUTPUT, "");
this.filename = OUTPUT_FILE_PATH +"/"+ filename+"/"+filename;
this.expected = expected;
}
@Test
public void testGOPTParser() {
try {
parser = new GoptParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in GoptParser"+filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testB3PW91() {
try {
parser = new B3PW91Parser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in B3PW91"+filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testCbsqParser() {
try {
parser = new CbsQParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Cbsq "+filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testFinalCoordParser() {
try {
parser = new FinalCoordParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in FinalCoord " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testG1Parser() {
try {
parser = new G1Parser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in G1 " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGaussianParser() {
try {
parser = new GaussianParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Gaussian " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGFinalCoord() {
try {
parser = new GFinalCoordParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in GfinalCoord Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGmcsfaParser() {
try {
parser = new GmcscfaParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Gmcsfa Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGvbParser() {
try {
parser = new GVBParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Gvb Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGscfaParser() {
try {
parser = new GscfaParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Gscfa Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testGnumatomParser() {
try {
parser = new GNumAtomParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in GnumAtom Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testInputParser() {
try {
parser = new InputParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Input Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testMethodParser() {
try {
parser = new MethodParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in MethodParser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void testMFinalCoordParser() {
try {
parser = new MFinalCoordParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in MFinalCoord Parser " + filename);
} catch (FileNotFoundException e) {
// log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
// log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestMoptaParser() {
try {
parser = new MOptaParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Mopta Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestMp2to5aParser() {
try {
parser = new MP2to5aParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Mp2to5a Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestMp2to5bParser() {
try {
parser = new MP2to5bParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Mp2to5b Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestMp2to5cParser() {
try {
parser = new MP2to5cParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Mp2to5c Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestMp2to5dParser() {
try {
parser = new MP2to5dParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Mp2to5d Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestScfaParser() {
try {
parser = new SCFaParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Scfa Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
@Test
public void TestScfbParser() {
try {
parser = new SCFbParser(new FileReader(this.filename));
HashMap<String, String> parsedData = parser.getParsedData();
Assert.assertEquals(expected, parsedData != null);
log.info("Parse successful in Scfb Parser " + filename);
} catch (FileNotFoundException e) {
log.error("FileNotFound in ..." + e.getMessage());
} catch (Exception e) {
log.error("Error occurred in parsing " + filename + " : " + e.getMessage());
}
}
}
| 9,140 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/inchi/InChIGeneratorGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.inchi;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChI;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChIGenerator;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.util.UUID;
public class InChIGeneratorGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(InChIGeneratorGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGetInChI() throws Exception {
try {
String uniqueID = UUID.randomUUID().toString();
File source = new File(TEST_OUTPUT);
File dest = new File(GridChemProperties.getInstance().getProperty(
Constants.TMP_DIR,"") + "/" + uniqueID + ".out");
FileUtils.copyFile(source, dest);
InChIGenerator inChIGenerator = new InChIGenerator(uniqueID);
InChI inChI = inChIGenerator.getInChI();
logger.info("TEST MESSAGE");
logger.info(inChI.getInchi() + " inchi key: " + inChI.getInchiKey());
Assert.assertNotNull(inChI.getInchi());
Assert.assertNotNull(inChI.getInchiKey());
} catch (IOException ignore) {
ignore.printStackTrace();
}
}
} | 9,141 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/scfa/SCFaGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.scfa;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.scfa.SCFaParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class SCFaGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(SCFaGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testScfaParser() {
boolean exception = false;
try {
SCFaParser p = new SCFaParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,142 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/finalcoord/FinalCoordParserGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.finalcoord;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.finalcoord.FinalCoordParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class FinalCoordParserGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(FinalCoordParserGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testFinalCoordParser() {
boolean exception = false;
try {
FinalCoordParser p = new FinalCoordParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
} | 9,143 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gvb/GVBGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gvb;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.gvb.GVBParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GVBGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GVBGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGVBParser() {
boolean exception = false;
try {
GVBParser p = new GVBParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,144 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/G1/G1GridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.G1;
import junit.framework.Assert;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.apache.airavata.datacat.parsers.gridchem.g1.G1Parser;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class G1GridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(G1GridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testG1Parser() {
boolean exception = false;
try {
G1Parser p = new G1Parser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,145 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gaussian/GaussianParserGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gaussian;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.gaussian.GaussianParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GaussianParserGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GaussianParserGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGoptParser() {
boolean exception = false;
try {
GaussianParser p = new GaussianParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,146 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/MP2to5a/MP2to5aGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.MP2to5a;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5a.MP2to5aParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class MP2to5aGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(MP2to5aGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMP2to5aParser() {
boolean exception = false;
try {
MP2to5aParser p = new MP2to5aParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,147 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/input/InputGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.input;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.input.InputParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class InputGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(InputGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testInputParser() {
boolean exception = false;
try {
InputParser p = new InputParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,148 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gopt/GoptGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gopt;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.gopt.GoptParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GoptGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GoptGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGoptParser() {
boolean exception = false;
try {
GoptParser p = new GoptParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,149 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/scfb/SCFbGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.scfb;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.scfb.SCFbParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class SCFbGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(SCFbGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testScfbParser() {
boolean exception = false;
try {
SCFbParser p = new SCFbParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,150 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/CbsQ/CbsQGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.CbsQ;
import junit.framework.Assert;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.apache.airavata.datacat.parsers.gridchem.cbsQ.CbsQParser;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.HashMap;
public class CbsQGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(CbsQGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testCbsQParser() {
boolean exception = false;
try {
CbsQParser p= new CbsQParser(new FileReader(TEST_OUTPUT));
HashMap<String,String> map=p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(map.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,151 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/mfinalcoord/MFinalCoordParserGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.mfinalcoord;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mfinalcoord.MFinalCoordParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class MFinalCoordParserGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(MFinalCoordParserGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMFinalCoordParser() {
boolean exception = false;
try {
MFinalCoordParser p = new MFinalCoordParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
} | 9,152 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/mp2to5d/Mp2to5dGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.mp2to5d;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5d.MP2to5dParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class Mp2to5dGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(Mp2to5dGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMP2to5dParser() {
boolean exception = false;
try {
MP2to5dParser p = new MP2to5dParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
Assert.assertNotNull(results);
logger.info("======= Printing the results==================");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,153 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/MP2to5c/MP2to5cGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.MP2to5c;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5c.MP2to5cParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class MP2to5cGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(MP2to5cGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMP2to5cParser() {
boolean exception = false;
try {
MP2to5cParser p = new MP2to5cParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,154 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gscfa/GscfaGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gscfa;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.gscfa.GscfaParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GscfaGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GscfaGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGVBParser() {
boolean exception = false;
try {
GscfaParser p = new GscfaParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,155 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/MP2to5b/MP2to5bGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.MP2to5b;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mp2to5b.MP2to5bParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class MP2to5bGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(MP2to5bGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMP2to5bParser() {
boolean exception = false;
try {
MP2to5bParser p = new MP2to5bParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..." + e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,156 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/mopta/MOptaGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.mopta;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.mopta.MOptaParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class MOptaGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(MOptaGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testMoptaParser() {
boolean exception = false;
try {
MOptaParser p = new MOptaParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..." + e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
} | 9,157 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/B3PW91/B3PW91GridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.B3PW91;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.B3PW91.B3PW91Parser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Map;
public class B3PW91GridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(B3PW91GridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testB3PW91Parser() {
boolean exception = false;
try {
B3PW91Parser p = new B3PW91Parser(new FileReader(TEST_OUTPUT));
p.parse();
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,158 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gFinalCoord/GFinalCoordGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gFinalCoord;
import junit.framework.Assert;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.apache.airavata.datacat.parsers.gridchem.gfinalcoord.GFinalCoordParser;
import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GFinalCoordGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GFinalCoordGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testFinalCoordParser() {
boolean exception = false;
try {
GFinalCoordParser p = new GFinalCoordParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,159 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/test/java/org/apche/airavata/datacat/parsers/gridchem/gmcscfa/GMCSCFaGridChemParserTest.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apche.airavata.datacat.parsers.gridchem.gmcscfa;
import junit.framework.Assert;
import org.apache.airavata.datacat.parsers.gridchem.gmcscfa.GmcscfaParser;
import org.apache.log4j.Logger;
import org.apche.airavata.datacat.parsers.gridchem.AbstractGridChemParserTest;
import org.junit.Before;
import org.junit.Test;
import java.io.FileNotFoundException;
import java.util.Map;
public class GMCSCFaGridChemParserTest extends AbstractGridChemParserTest {
private Logger logger = Logger.getLogger(GMCSCFaGridChemParserTest.class);
@Before
public void setUp() {
super.setUp();
}
@Test
public void testGmcsfaParser() {
boolean exception = false;
try {
GmcscfaParser p = new GmcscfaParser(new java.io.FileReader(TEST_OUTPUT));
Map<String, String> results = p.getParsedData();
logger.info("======= Printing the results ==========");
logger.info(results.toString());
} catch (FileNotFoundException e) {
logger.error("File Not Found Exception ..."+e.getMessage());
exception = true;
} catch (Exception e) {
logger.error("Parse Exception ..." + e.getMessage());
exception = true;
}
Assert.assertFalse(exception);
}
}
| 9,160 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/IParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers;
import org.apache.airavata.datacat.models.OutputMetadataDTO;
import org.apache.airavata.datacat.models.OutputMonitorMessage;
public interface IParser {
public OutputMetadataDTO parse(OutputMonitorMessage outputMonitorMessage);
}
| 9,161 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/DefaultParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers;
import org.apache.airavata.datacat.models.OutputMetadataDTO;
import org.apache.airavata.datacat.models.OutputMonitorMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
/**
* This is a test parser to to work with PHP Reference Gateway.
*/
public class DefaultParser implements IParser {
private final static Logger logger = LoggerFactory.getLogger(DefaultParser.class);
@Override
public OutputMetadataDTO parse(OutputMonitorMessage outputMonitorMessage) {
//only a sample set of metadata is set.
OutputMetadataDTO outputMetadataDTO = new OutputMetadataDTO();
outputMetadataDTO.setExperimentId(outputMonitorMessage.getExperimentID());
outputMetadataDTO.setExperimentName(outputMonitorMessage.getExperimentName());
outputMetadataDTO.setOutputPath(outputMonitorMessage.getOutputPath());
outputMetadataDTO.setOwnerId(outputMonitorMessage.getOwnerId());
outputMetadataDTO.setGatewayId(outputMonitorMessage.getGatewayId());
outputMetadataDTO.setApplicationName(outputMonitorMessage.getApplicationName());
outputMetadataDTO.setHost(outputMonitorMessage.getHost());
//For Solr requirement date is in the format of yyyy-MM-ddTHH:mm:ssZ
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
//rounding off the day
String date = dateFormat.format(now).split(" ")[0] + "T" + dateFormat.format(now).split(" ")[1] + "Z/DAY";
outputMetadataDTO.setCreatedDate(date);
HashMap<String, String> customMetadata = new HashMap<>();
outputMetadataDTO.setCustomMetaData(customMetadata);
return outputMetadataDTO;
}
} | 9,162 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/GridChemParser.java |
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem;
import org.apache.airavata.datacat.models.OutputMetadataDTO;
import org.apache.airavata.datacat.models.OutputMonitorMessage;
import org.apache.airavata.datacat.parsers.IParser;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChI;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChIGenerator;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.File;
import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class GridChemParser implements IParser {
private final Logger logger = LogManager.getLogger(GridChemParser.class);
private String[] gridChemQueueParserses;
public GridChemParser() {
}
public OutputMetadataDTO parse(OutputMonitorMessage outputMonitorMessage) {
gridChemQueueParserses = GridChemProperties.getInstance().getParserSequence();
logger.info("Loaded the GridChem Parser Sequence ...");
logger.info("Started passing new file monitor message...");
OutputMetadataDTO outputMetadataDTO = new OutputMetadataDTO();
//For Solr requirement date is in the format of yyyy-MM-ddTHH:mm:ssZ
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = new Date();
String date = dateFormat.format(now).split(" ")[0] + "T" + dateFormat.format(now).split(" ")[1] + "Z";
//setting the basic file meta-data
outputMetadataDTO.setCreatedDate(date);
outputMetadataDTO.setHost(computingResourceName());
outputMetadataDTO.setExperimentName(outputMonitorMessage.getExperimentName());
outputMetadataDTO.setExperimentId(outputMonitorMessage.getExperimentID());
outputMetadataDTO.setOutputPath(outputMonitorMessage.getOutputPath());
outputMetadataDTO.setApplicationName(applicationName());
outputMetadataDTO.setOwnerId(getOwnerId());
String[] outPutFiles = (new File(outputMonitorMessage.getOutputPath())).list(new FilenameFilter() {
public boolean accept(File dir, String filename) {
return filename.endsWith(".out");
}
});
Map<String, String> results = new HashMap<String, String>();
if (outPutFiles != null && outPutFiles.length > 0) {
// have a copy of the file in a temp location
//FIXME: is this really necessary?
String outFilePath = outputMonitorMessage.getOutputPath() + File.separator + outPutFiles[0];
String uniqueID = UUID.randomUUID().toString();
File source = new File(outFilePath);
File dest = new File(GridChemProperties.getInstance().getProperty(
Constants.TMP_DIR, "") + "/" + uniqueID + ".out");
try{
FileUtils.copyFile(source, dest);
try {
InChIGenerator inChIGenerator = new InChIGenerator(uniqueID);
InChI inChI = inChIGenerator.getInChI();
results.put("InChi", inChI.getInchi());
results.put("InChiKey", inChI.getInchiKey());
//running the parser queue serially
Map<String, String> parserResult;
for (int j = 0; j < gridChemQueueParserses.length; j++) {
try {
long time = System.currentTimeMillis();
//copying the file to the memory
//FIXME make this file shared rather than re-reading it.
FileReader fileReader = new FileReader(dest);
parserResult = loadAndParse(gridChemQueueParserses[j], fileReader);
results.putAll(parserResult);
} catch (Exception ex) {
logger.error(
"Parser Failure in " + outputMetadataDTO.getOutputPath() + "/" + outputMetadataDTO.getOutputPath()
+ " in " + gridChemQueueParserses[j]
);
}
}
} catch (Exception ex) {
logger.error(
"Parser Failure in " + outputMetadataDTO.getOutputPath() + "/" + outputMetadataDTO.getExperimentName()
+ " in InChi Generators"
);
}
}catch (IOException ex){
logger.error("Cannot copy temp file to the tmp directory");
}
//adding the custom parsed data to the fileMetaDataObject
outputMetadataDTO.setCustomMetaData(results);
return outputMetadataDTO;
}
logger.info("No output file corresponding to the file monitor message location");
return null;
}
private HashMap<String, String> loadAndParse(String classname, final FileReader reader) throws Exception {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
Class parser = null;
try {
//todo: handle unparsed documents and log and ignore
parser = classLoader.loadClass(classname);
Constructor parserConstructor = parser.getConstructor(FileReader.class);
GridChemQueueParser queueParser = (GridChemQueueParser) parserConstructor.newInstance(reader);
HashMap<String, String> parsedData = queueParser.getParsedData();
return parsedData;
} catch (ClassNotFoundException e) {
logger.error("Could not load the class ..." + e.getMessage());
} catch (NoSuchMethodException e) {
logger.error("Could not load the constructor ... " + e.getMessage());
} catch (InvocationTargetException e) {
logger.error("Could not load the Class ... " + e.getMessage());
} catch (InstantiationException e) {
logger.error("Could not load the Class ... " + e.getMessage());
} catch (IllegalAccessException e) {
logger.error("Could not load the Class ... " + e.getMessage());
}
return null;
}
public String computingResourceName() {
return GridChemProperties.getInstance().getProperty(Constants.ARCHIVING_NODE, "");
}
public String applicationName() {
return GridChemProperties.getInstance().getProperty(Constants.APPLICATION_NAME, "");
}
public String getOwnerId() {
return GridChemProperties.getInstance().getProperty(Constants.USERNAME, "");
}
} | 9,163 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/GridChemQueueParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem;
import java.util.HashMap;
// Interface for individual parsers of the cup flex files
public interface GridChemQueueParser {
//parses the data using a file reader and returns a hash map of outputs
public HashMap<String, String> getParsedData() throws Exception;
}
| 9,164 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/GridChemDemoParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem;
import org.apache.airavata.datacat.models.OutputMetadataDTO;
import org.apache.airavata.datacat.models.OutputMonitorMessage;
import org.apache.airavata.datacat.parsers.DefaultParser;
import org.apache.airavata.datacat.parsers.IParser;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChI;
import org.apache.airavata.datacat.parsers.gridchem.inchi.InChIGenerator;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.HashMap;
import java.util.UUID;
public class GridChemDemoParser extends DefaultParser implements IParser{
private final static Logger logger = LoggerFactory.getLogger(GridChemDemoParser.class);
@Override
public OutputMetadataDTO parse(OutputMonitorMessage outputMonitorMessage) {
OutputMetadataDTO outputMetadataDTO = super.parse(outputMonitorMessage);
HashMap<String, String> customMetadata = new HashMap<>();
String[] outPutFiles = (new File(outputMonitorMessage.getOutputPath())).list(new FilenameFilter() {
public boolean accept(File dir, String filename) {
return filename.endsWith(".out");
}
});
if (outPutFiles != null && outPutFiles.length > 0) {
String outFilePath = outputMonitorMessage.getOutputPath() + File.separator + outPutFiles[0];
String uniqueID = UUID.randomUUID().toString();
File source = new File(outFilePath);
File dest = new File(GridChemProperties.getInstance().getProperty(
Constants.TMP_DIR, "") + "/" + uniqueID + ".out");
try {
FileUtils.copyFile(source, dest);
try {
InChIGenerator inChIGenerator = new InChIGenerator(uniqueID);
InChI inChI = inChIGenerator.getInChI();
customMetadata.put("inChi", inChI.getInchi());
customMetadata.put("inChiKey", inChI.getInchiKey());
} catch (Exception ex) {
logger.error(
"Parser Failure in " + outputMetadataDTO.getOutputPath() + "/" + outputMetadataDTO.getExperimentName()
+ " in InChi Generators"
);
}
} catch (IOException ex) {
logger.error("Cannot copy temp file to the tmp directory");
}
}
outputMetadataDTO.setCustomMetaData(customMetadata);
return outputMetadataDTO;
}
} | 9,165 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/Settings.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem;
public class Settings {
public static final boolean DEBUG = true;
}
| 9,166 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/inchi/InChIGenerator.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.inchi;
import org.apache.airavata.datacat.parsers.gridchem.util.Constants;
import org.apache.airavata.datacat.parsers.gridchem.util.GridChemProperties;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class InChIGenerator {
private String filePrefix;
public InChIGenerator(String filePrefix) {
this.filePrefix = filePrefix;
}
private BufferedReader runInChI(String molfile) throws IOException {
String[] command = {
"/bin/sh",
"-c",
"echo \"" + molfile + "\" | ./inchi-1 -STDIO -AuxNone -NoLabels -Key 2>/dev/null"
};
Process inchi = Runtime.getRuntime().exec(command);
try {
inchi.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
return new BufferedReader(new InputStreamReader(inchi.getInputStream()));
}
public InChI getInChI() throws IOException {
convertGaussian2Mol();
String molfile = readFile(GridChemProperties.getInstance().getProperty(
Constants.TMP_DIR,"") + "/" + filePrefix + ".mol");
BufferedReader input = runInChI(molfile);
String result = input.readLine();
String inchiStr = result == null ? "" : result;
result = input.readLine();
String inchiKey = result == null ? "" : result.substring(9);
InChI inChI = new InChI(inchiStr, inchiKey);
input.close();
return inChI;
}
private void convertGaussian2Mol() throws IOException {
Process inchi = Runtime.getRuntime().exec("babel -i g09 "
+ GridChemProperties.getInstance().getProperty(Constants.TMP_DIR,"") + "/" + filePrefix + ".out -o mol "
+ GridChemProperties.getInstance().getProperty(Constants.TMP_DIR,"") + "/" + filePrefix + ".mol\n");
try {
inchi.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private String readFile(String filename) throws IOException {
BufferedReader in = new BufferedReader(new FileReader(filename));
String str = "";
String molfile = "";
while ((str = in.readLine()) != null) {
molfile = molfile + str + "\n";
}
in.close();
return molfile;
}
}
| 9,167 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/inchi/InChI.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.inchi;
public class InChI {
private String inchi;
private String inchiKey;
public InChI(String inchi, String inchiKey) {
this.inchi = inchi;
this.inchiKey = inchiKey;
}
public String getInchiKey() {
return inchiKey;
}
public void setInchiKey(String inchiKey) {
this.inchiKey = inchiKey;
}
public String getInchi() {
return inchi;
}
public void setInchi(String inchi) {
this.inchi = inchi;
}
}
| 9,168 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/scfa/SCFaSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.scfa;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Mon Sep 15 15:43:00 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class SCFaSym {
/* terminals */
public static final int MGRAD = 10;
public static final int RmsGrad = 7;
public static final int Energ = 5;
public static final int MaxGrad = 6;
public static final int ENERGY = 9;
public static final int EOF = 0;
public static final int ITERATION = 8;
public static final int NSearch = 4;
public static final int RGRAD = 11;
public static final int error = 1;
public static final int SCFDONE = 3;
public static final int FOUNDITER = 2;
}
| 9,169 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/scfa/SCFaLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.scfa;/* The following code was generated by JFlex 1.4.3 on 9/15/14 3:42 PM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/15/14 3:42 PM from the specification file
* <tt>scfa.flex</tt>
*/
public class SCFaLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int ITER2 = 4;
public static final int INTVALUE = 8;
public static final int IGNOREALL = 16;
public static final int ITER = 2;
public static final int YYINITIAL = 0;
public static final int FLOAT2 = 14;
public static final int FLOAT1 = 12;
public static final int FLOATVALUE = 10;
public static final int ITER3 = 6;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2,
2, 2
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6, 0, 0, 0, 0, 0, 0, 0, 21, 5, 0, 2, 0, 2, 3, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 14, 0, 0, 4, 0, 0,
0, 0, 0, 12, 18, 17, 13, 0, 23, 0, 0, 0, 0, 0, 0, 0,
0, 0, 24, 11, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 16, 0, 9, 0, 0, 8, 0, 0, 0, 10, 0, 20, 19,
0, 0, 0, 7, 0, 0, 0, 0, 0, 15, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\5\0\5\1\1\2\3\1\7\0\1\3\2\0\1\4"+
"\5\0\1\5\12\0\1\6\15\0\1\7\1\10";
private static int [] zzUnpackAction() {
int [] result = new int[57];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\31\0\62\0\113\0\144\0\175\0\226\0\257"+
"\0\310\0\341\0\372\0\372\0\u0113\0\u012c\0\u0145\0\u015e"+
"\0\u0177\0\u0190\0\u0113\0\u01a9\0\u01c2\0\175\0\u01db\0\u01f4"+
"\0\u01a9\0\u020d\0\u0226\0\u023f\0\u0258\0\u0271\0\175\0\u028a"+
"\0\u02a3\0\u02bc\0\u02d5\0\u02ee\0\u0307\0\u0320\0\u0339\0\u0352"+
"\0\u036b\0\175\0\u0384\0\u039d\0\u03b6\0\u03cf\0\u03e8\0\u0401"+
"\0\u041a\0\u0433\0\u044c\0\u0465\0\u047e\0\u0497\0\u04b0\0\175"+
"\0\175";
private static int [] zzUnpackRowMap() {
int [] result = new int[57];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\6\6\1\7\30\6\1\10\4\6\1\11\1\12\46\6"+
"\1\13\1\14\27\6\1\15\1\16\26\6\40\0\1\17"+
"\42\0\1\20\23\0\1\21\33\0\1\22\12\0\1\13"+
"\30\0\1\23\1\0\1\24\26\0\1\23\37\0\1\25"+
"\24\0\1\26\41\0\1\27\33\0\1\30\11\0\1\31"+
"\40\0\1\32\25\0\1\33\34\0\1\34\30\0\1\35"+
"\40\0\1\36\17\0\1\37\31\0\1\40\41\0\1\41"+
"\13\0\1\42\46\0\1\43\17\0\1\44\26\0\1\45"+
"\33\0\1\46\32\0\1\47\27\0\1\50\21\0\1\51"+
"\40\0\1\52\20\0\1\53\43\0\1\54\34\0\1\55"+
"\31\0\1\56\1\0\1\57\27\0\1\60\30\0\1\61"+
"\16\0\1\62\30\0\1\63\20\0\1\64\30\0\1\65"+
"\31\0\1\66\30\0\1\67\26\0\1\70\30\0\1\71"+
"\24\0";
private static int [] zzUnpackTrans() {
int [] result = new int[1225];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\5\0\1\11\10\1\7\0\1\11\2\0\1\1\5\0"+
"\1\11\12\0\1\11\15\0\2\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[57];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public SCFaLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public SCFaLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 6:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found Shell SCF");
yybegin(ITER);
return new Symbol(SCFaSym.FOUNDITER);
}
case 9: break;
case 5:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found the cycle number");
yybegin(INTVALUE);
return new Symbol(SCFaSym.NSearch);
}
case 10: break;
case 7:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Done");
yybegin(IGNOREALL);
return new Symbol(SCFaSym.SCFDONE);
}
case 11: break;
case 2:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found iteration");
if (Settings.DEBUG) System.out.println(yytext());
yybegin (ITER);
return new Symbol(SCFaSym.ITERATION, new Integer(yytext()));
}
case 12: break;
case 8:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found the energy");
yybegin(IGNOREALL);
return new Symbol(SCFaSym.SCFDONE);
}
case 13: break;
case 4:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found in FLOATVALUE the energy");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER);
return new Symbol(SCFaSym.ENERGY, new Float(yytext()));
}
case 14: break;
case 3:
{ if (Settings.DEBUG) System.out.println("SCFaFlex: Found the energy");
yybegin(FLOATVALUE);
return new Symbol(SCFaSym.Energ);
}
case 15: break;
case 1:
{
}
case 16: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(SCFaSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = SCFaSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java SCFaLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
SCFaLexer scanner = null;
try {
scanner = new SCFaLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,170 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/scfa/SCFaParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.scfa;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import javax.swing.*;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
public class SCFaParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public SCFaParser() {super();}
/** Constructor which sets the default scanner. */
public SCFaParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public SCFaParser(final FileReader fileReader) {
super(new SCFaLexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\010\000\002\003\005\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\012\002" +
"\000\002\006\006\000\002\007\004"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\017\000\004\004\005\001\002\000\004\006\011\001" +
"\002\000\004\006\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\006\005\020\006\011\001" +
"\002\000\004\012\013\001\002\000\006\005\ufffd\006\ufffd" +
"\001\002\000\004\007\ufffc\001\002\000\004\007\015\001" +
"\002\000\004\013\017\001\002\000\006\005\ufffb\006\ufffb" +
"\001\002\000\006\005\ufffa\006\ufffa\001\002\000\004\002" +
"\001\001\002\000\006\005\ufffe\006\ufffe\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\017\000\006\003\005\004\003\001\001\000\006\005" +
"\007\006\011\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\004\006\020\001\001\000\002\001" +
"\001\000\002\001\001\000\004\012\013\001\001\000\004" +
"\007\015\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
//Each string is of the format
//energy, iteration
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results= new HashMap<String,String>();
int energyCount=0;
int iterationCount=0;
for(int i=0;i<result.size();i++){
String singleString = result.get(i);
String[] temp= singleString.split(" ");
if(temp.length>1){
String keyString= temp[0];
String dataString=temp[1];
if(keyString.equalsIgnoreCase("ENERGY")){
results.put("SCFaParser_ENERGY_"+energyCount,dataString);
energyCount++;
}else if(keyString.equalsIgnoreCase("ITERATION")){
results.put("SCFaParser_ITERATION_"+iterationCount,dataString);
iterationCount++;
}
}
}
return results;
}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private static JTable table;
private static final String tableLabel = "SCF Intermediate Results:";
// private static String cycle = "0";
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
// }
private final SCFaParser SCFaParser;
/** Constructor */
CUP$parser$actions(SCFaParser SCFaParser) {
this.SCFaParser = SCFaParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // cycle ::= Energ ENERGY
{
Object RESULT = null;
int enerleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int enerright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float ener = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:scfa: ENERGY "+ener);
SCFaParser.addToResult("ENERGY "+ener);
CUP$parser$result = new java_cup.runtime.Symbol(5/*cycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // scfcycle ::= NSearch ITERATION NT$0 cycle
{
Object RESULT = null;
// propagate RESULT from NT$0
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int iterleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int iterright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Integer iter = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // NT$0 ::=
{
Object RESULT = null;
int iterleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int iterright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer iter = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:scfa: ITERATION "+iter);
SCFaParser.addToResult("ITERATION "+iter);
CUP$parser$result = new java_cup.runtime.Symbol(8/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:scfa: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:scfa: found the start of Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: end of parse tree ");
table = new JTable();
// table = parseSCF.getTable();
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,171 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/finalcoord/FinalCoordSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.finalcoord;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Sun Aug 03 21:31:23 IST 2014
//----------------------------------------------------
/**
* CUP generated class containing symbol constants.
*/
public class FinalCoordSym {
/* terminals */
public static final int ENERGY = 11;
public static final int EOF = 0;
public static final int ITERATION = 10;
public static final int INPUT7 = 14;
public static final int error = 1;
public static final int INPUT6 = 13;
public static final int INPUT5 = 12;
public static final int INPUT4 = 9;
public static final int SCFDONE = 4;
public static final int INPUT3 = 8;
public static final int FOUNDITER = 3;
public static final int INPUT2 = 7;
public static final int DASH2 = 6;
public static final int INPUT1 = 2;
public static final int DASH1 = 5;
}
| 9,172 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/finalcoord/FinalCoordParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.finalcoord;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import javax.swing.*;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Stack;
public class FinalCoordParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/**
* Constructor which uses a file reader.
*/
public FinalCoordParser(final FileReader fileReader) {
super(new FinalCoordLexer(fileReader));
}
/**
* Production table.
*/
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\016\000\002\003\005\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\006\006" +
"\000\002\017\004\000\002\017\003\000\002\020\010\000" +
"\002\012\003\000\002\013\003\000\002\014\003\000\002" +
"\015\003\000\002\016\003"});
/**
* Parse-action table.
*/
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\032\000\004\005\005\001\002\000\004\004\010\001" +
"\002\000\004\004\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\004\007\015\001\002\000" +
"\006\004\010\006\013\001\002\000\006\004\ufffd\006\ufffd" +
"\001\002\000\004\002\001\001\002\000\006\004\ufffe\006" +
"\ufffe\001\002\000\004\011\016\001\002\000\004\012\ufff8" +
"\001\002\000\004\012\025\001\002\000\006\010\ufffa\011" +
"\ufffa\001\002\000\006\010\022\011\016\001\002\000\006" +
"\004\ufffc\006\ufffc\001\002\000\006\010\ufffb\011\ufffb\001" +
"\002\000\004\013\026\001\002\000\004\013\ufff7\001\002" +
"\000\004\016\027\001\002\000\004\017\ufff6\001\002\000" +
"\004\017\031\001\002\000\004\020\ufff5\001\002\000\004" +
"\020\033\001\002\000\006\010\ufff4\011\ufff4\001\002\000" +
"\006\010\ufff9\011\ufff9\001\002"});
/**
* <code>reduce_goto</code> table.
*/
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\032\000\006\003\005\004\003\001\001\000\006\005" +
"\010\006\011\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\004\006\013\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\010\012\016\017\020\020\017\001\001\000\002\001" +
"\001\000\004\013\023\001\001\000\002\001\001\000\006" +
"\012\016\020\022\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\004\014\027" +
"\001\001\000\002\001\001\000\004\015\031\001\001\000" +
"\002\001\001\000\004\016\033\001\001\000\002\001\001" +
"\000\002\001\001"});
/**
* Instance of action encapsulation class.
*/
protected CUP$parser$actions action_obj;
//Each string is of the format
//center# atomic# x_coord y_coord z_coord
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
/**
* Default constructor.
*/
public FinalCoordParser() {
super();
}
/**
* Constructor which sets the default scanner.
*/
public FinalCoordParser(java_cup.runtime.Scanner s) {
super(s);
}
/**
* Access to production table.
*/
@Override
public short[][] production_table() {
return _production_table;
}
/**
* Access to parse-action table.
*/
@Override
public short[][] action_table() {
return _action_table;
}
/**
* Access to <code>reduce_goto</code> table.
*/
@Override
public short[][] reduce_table() {
return _reduce_table;
}
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results= new HashMap<String,String>();
int zCount=0;
int xCount=0;
int yCount=0;
int center=0;
int atom=0;
for(int i=0;i<result.size();i++){
String singleString= result.get(i);
String[] temp=singleString.split(" ");
if(temp.length>1){
String keyElement=temp[0];
String dataElement=temp[1];
if(keyElement.equals("Z")){
results.put("FinalCoordParser_Z_coord_"+zCount,dataElement);
zCount++;
}else if(keyElement.equals("Y")){
results.put("FinalCoordParser_Y_coord_"+yCount,dataElement);
yCount++;
}else if(keyElement.equals("X")) {
results.put("FinalCoordParser_X_coord_" + xCount, dataElement);
xCount++;
}else if(keyElement.equals("Atom")) {
results.put("FinalCoordParser_AtomicNumber_" + atom, dataElement);
atom++;
}else if(keyElement.equals("center")) {
results.put("FinalCoordParser_CenterNumber_" + center, dataElement);
center++;
}
}
}
return results;
}
/**
* Action encapsulation object initializer.
*/
protected void init_actions() {
action_obj = new CUP$parser$actions(this);
}
/**
* Invoke a user supplied parse action.
*/
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
Stack stack,
int top)
throws Exception {
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/**
* Indicates start state.
*/
public int start_state() {
return 0;
}
/**
* Indicates start production.
*/
public int start_production() {
return 1;
}
/**
* <code>EOF</code> Symbol index.
*/
public int EOF_sym() {
return 0;
}
/**
* <code>error</code> Symbol index.
*/
public int error_sym() {
return 1;
}
}
/**
* Cup generated class to encapsulate user supplied action code.
*/
class CUP$parser$actions {
private static final String tableLabel = "SCF Intermediate Results:";
//__________________________________
public static boolean DEBUG = false;
private static JTable table;
// private static String cycle = "0";
private final FinalCoordParser FinalCoordParser;
/**
* Constructor
*/
CUP$parser$actions(FinalCoordParser FinalCoordParser) {
this.FinalCoordParser = FinalCoordParser;
}
// }
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
/**
* Method with the actual generated action code.
*/
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
Stack CUP$parser$stack,
int CUP$parser$top)
throws Exception {
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num) {
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // inp7 ::= INPUT7
{
Object RESULT = null;
int in7left = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left;
int in7right = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right;
Float in7 = (Float) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: z coordinate " + in7);
FinalCoordParser.setTempStr(FinalCoordParser.getTempStr() + "," + in7);
FinalCoordParser.getResult().add(FinalCoordParser.getTempStr());
FinalCoordParser.setTempStr("");
FinalCoordParser.addToResult("Z "+in7);
CUP$parser$result = new java_cup.runtime.Symbol(12/*inp7*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // inp6 ::= INPUT6
{
Object RESULT = null;
int in6left = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left;
int in6right = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right;
Float in6 = (Float) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: y coordinate " + in6);
FinalCoordParser.setTempStr(FinalCoordParser.getTempStr() + "," + in6);
FinalCoordParser.addToResult("Y "+in6);
CUP$parser$result = new java_cup.runtime.Symbol(11/*inp6*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // inp5 ::= INPUT5
{
Object RESULT = null;
int in5left = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left;
int in5right = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right;
Float in5 = (Float) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: x coordinate " + in5);
FinalCoordParser.setTempStr(FinalCoordParser.getTempStr() + "," + in5);
FinalCoordParser.addToResult("X "+in5);
CUP$parser$result = new java_cup.runtime.Symbol(10/*inp5*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // inp3 ::= INPUT3
{
Object RESULT = null;
int in3left = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left;
int in3right = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right;
Integer in3 = (Integer) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: atomic number " + in3);
FinalCoordParser.setTempStr(FinalCoordParser.getTempStr() + "," + in3);
FinalCoordParser.addToResult("Atom "+in3);
CUP$parser$result = new java_cup.runtime.Symbol(9/*inp3*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // inp2 ::= INPUT2
{
Object RESULT = null;
int in2left = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left;
int in2right = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right;
Integer in2 = (Integer) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: center number " + in2);
FinalCoordParser.addToResult("center "+in2);
FinalCoordParser.setTempStr(FinalCoordParser.getTempStr() + in2);
CUP$parser$result = new java_cup.runtime.Symbol(8/*inp2*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // cycle2 ::= inp2 inp3 INPUT4 inp5 inp6 inp7
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(14/*cycle2*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 5)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // cycle1 ::= cycle2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(13/*cycle1*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // cycle1 ::= cycle1 cycle2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(13/*cycle1*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // scfcycle ::= INPUT1 DASH1 cycle1 DASH2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 3)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:Input: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:Input: found the start of Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).left;
int start_valright = ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).right;
Object start_val = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 1)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 2)).left, ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top - 0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,173 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/finalcoord/FinalCoordLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.finalcoord;/* The following code was generated by JFlex 1.4.3 on 8/3/14 9:30 PM */
import java_cup.runtime.Symbol;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 8/3/14 9:30 PM from the specification file
* <tt>finalcoord.flex</tt>
*/
public class FinalCoordLexer implements java_cup.runtime.Scanner {
/**
* This character denotes the end of file
*/
public static final int YYEOF = -1;
/**
* lexical states
*/
public static final int INPUTF = 30;
public static final int ITER2 = 4;
public static final int INPUTE = 28;
public static final int INPUTD = 26;
public static final int INPUTC = 24;
public static final int INPUTB = 22;
public static final int INPUTA = 20;
public static final int INTVALUE = 8;
public static final int INPUT = 18;
public static final int IGNOREALL = 16;
public static final int ITER = 2;
public static final int YYINITIAL = 0;
/**
* the current lexical state
*/
private int zzLexicalState = YYINITIAL;
public static final int FLOAT2 = 14;
public static final int FLOAT1 = 12;
public static final int FLOATVALUE = 10;
public static final int ITER3 = 6;
/**
* initial size of the lookahead buffer
*/
private static final int ZZ_BUFFERSIZE = 16384;
/**
* this buffer contains the current text to be matched and is
* the source of the yytext() string
*/
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9
};
/**
* Translates characters to character classes
*/
private static final char[] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 19, 3, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23, 0, 0, 0, 0, 0,
0, 0, 0, 0, 31, 28, 4, 0, 27, 33, 0, 0, 34, 20, 30, 32,
0, 0, 0, 5, 26, 0, 0, 0, 24, 25, 18, 0, 0, 0, 0, 29,
0, 7, 0, 0, 17, 22, 15, 0, 0, 8, 0, 0, 0, 0, 10, 9,
14, 0, 11, 0, 6, 16, 0, 0, 21, 12, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int[] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\12\0\6\1\1\2\2\1\1\3\1\1\1\4\10\1" +
"\23\0\1\5\1\6\1\7\122\0\1\10\41\0\1\11" +
"\3\0\1\12\11\0\1\13\130\0\1\14\1\15";
/**
* Translates a state to a row index in the transition table
*/
private static final int[] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\43\0\106\0\151\0\214\0\257\0\322\0\365" +
"\0\u0118\0\u013b\0\u015e\0\u0181\0\u01a4\0\u01c7\0\u01ea\0\u020d" +
"\0\u0230\0\u0230\0\u0253\0\u0276\0\u0276\0\u0299\0\u0299\0\u02bc" +
"\0\u02df\0\u0302\0\u0325\0\u0348\0\u036b\0\u038e\0\u03b1\0\u03d4" +
"\0\u03f7\0\u041a\0\u043d\0\u0460\0\u02bc\0\u0483\0\u0302\0\u04a6" +
"\0\u0348\0\u04c9\0\u04ec\0\u050f\0\u0532\0\u0555\0\u0578\0\u059b" +
"\0\u05be\0\u0483\0\u04a6\0\u04c9\0\u05e1\0\u0604\0\u0627\0\u064a" +
"\0\u066d\0\u0690\0\u06b3\0\u06d6\0\u06f9\0\u071c\0\u073f\0\u0762" +
"\0\u0785\0\u07a8\0\u07cb\0\u07ee\0\u0811\0\u0834\0\u0857\0\u087a" +
"\0\u089d\0\u08c0\0\u08e3\0\u0906\0\u0929\0\u094c\0\u096f\0\u0992" +
"\0\u09b5\0\u09d8\0\u09fb\0\u0a1e\0\u0a41\0\u0a64\0\u0a87\0\u0aaa" +
"\0\u0acd\0\u0af0\0\u0b13\0\u0b36\0\u0b59\0\u0b7c\0\u0b9f\0\u0bc2" +
"\0\u0be5\0\u0c08\0\u0c2b\0\u0c4e\0\u0c71\0\u0c94\0\u0cb7\0\u0cda" +
"\0\u0cfd\0\u0d20\0\u0d43\0\u0d66\0\u0d89\0\u0dac\0\u0dcf\0\u0df2" +
"\0\u0e15\0\u0e38\0\u0e5b\0\u0e7e\0\u0ea1\0\u0ec4\0\u0ee7\0\u0f0a" +
"\0\u0f2d\0\u0f50\0\u0f73\0\u0f96\0\u0fb9\0\u0fdc\0\u0fff\0\u1022" +
"\0\u1045\0\u1068\0\u108b\0\u10ae\0\u10d1\0\u10f4\0\u015e\0\u1117" +
"\0\u113a\0\u115d\0\u1180\0\u11a3\0\u11c6\0\u11e9\0\u120c\0\u122f" +
"\0\u1252\0\u1275\0\u1298\0\u12bb\0\u12de\0\u1301\0\u1324\0\u1347" +
"\0\u136a\0\u138d\0\u13b0\0\u13d3\0\u13f6\0\u1419\0\u143c\0\u145f" +
"\0\u1482\0\u14a5\0\u14c8\0\u14eb\0\u150e\0\u1531\0\u1554\0\u1577" +
"\0\u015e\0\u159a\0\u15bd\0\u15e0\0\u015e\0\u1603\0\u1626\0\u1649" +
"\0\u166c\0\u168f\0\u16b2\0\u16d5\0\u16f8\0\u171b\0\u015e\0\u173e" +
"\0\u1761\0\u1784\0\u17a7\0\u17ca\0\u17ed\0\u1810\0\u1833\0\u1856" +
"\0\u1879\0\u189c\0\u18bf\0\u18e2\0\u1905\0\u1928\0\u194b\0\u196e" +
"\0\u1991\0\u19b4\0\u19d7\0\u19fa\0\u1a1d\0\u1a40\0\u1a63\0\u1a86" +
"\0\u1aa9\0\u1acc\0\u1aef\0\u1b12\0\u1b35\0\u1b58\0\u1b7b\0\u1b9e" +
"\0\u1bc1\0\u1be4\0\u1c07\0\u1c2a\0\u1c4d\0\u1c70\0\u1c93\0\u1cb6" +
"\0\u1cd9\0\u1cfc\0\u1d1f\0\u1d42\0\u1d65\0\u1d88\0\u1dab\0\u1dce" +
"\0\u1df1\0\u1e14\0\u1e37\0\u1e5a\0\u1e7d\0\u1ea0\0\u1ec3\0\u1ee6" +
"\0\u1f09\0\u1f2c\0\u1f4f\0\u1f72\0\u1f95\0\u1fb8\0\u1fdb\0\u1ffe" +
"\0\u2021\0\u2044\0\u2067\0\u208a\0\u20ad\0\u20d0\0\u20f3\0\u2116" +
"\0\u2139\0\u215c\0\u217f\0\u21a2\0\u21c5\0\u21e8\0\u220b\0\u222e" +
"\0\u2251\0\u2274\0\u2297\0\u22ba\0\u22dd\0\u2300\0\u2323\0\u015e" +
"\0\u015e";
/**
* The transition table of the DFA
*/
private static final int[] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\5\13\1\14\14\13\1\15\25\13\1\16\22\13\1\17" +
"\1\13\1\20\54\13\1\21\1\22\20\13\1\23\20\13" +
"\1\24\1\25\20\13\1\25\20\13\1\26\1\27\20\13" +
"\1\27\20\13\1\30\1\31\20\13\1\31\20\13\1\32" +
"\1\33\20\13\1\33\20\13\1\34\1\35\20\13\1\35" +
"\42\13\1\36\17\13\51\0\1\37\57\0\1\40\25\0" +
"\1\41\51\0\1\42\60\0\1\43\10\0\1\21\42\0" +
"\1\21\21\0\1\44\20\0\1\24\42\0\1\26\42\0" +
"\1\45\1\0\1\46\40\0\1\45\42\0\1\47\1\0" +
"\1\50\40\0\1\47\42\0\1\51\1\0\1\52\40\0" +
"\1\51\64\0\1\53\26\0\1\54\57\0\1\55\25\0" +
"\1\56\50\0\1\57\61\0\1\60\31\0\1\61\20\0" +
"\1\62\42\0\1\63\42\0\1\64\64\0\1\65\25\0" +
"\1\66\43\0\1\67\45\0\1\70\45\0\1\71\62\0" +
"\1\72\30\0\1\73\42\0\1\74\27\0\1\75\40\0" +
"\1\76\55\0\1\77\36\0\1\100\61\0\1\101\31\0" +
"\1\102\42\0\1\103\30\0\1\104\44\0\1\105\36\0" +
"\1\106\50\0\1\107\63\0\1\110\27\0\1\111\42\0" +
"\1\112\31\0\1\113\40\0\1\114\45\0\1\115\44\0" +
"\1\116\64\0\1\117\26\0\1\120\42\0\1\121\26\0" +
"\1\122\60\0\1\123\36\0\1\124\36\0\1\125\62\0" +
"\1\126\30\0\1\127\42\0\1\130\32\0\1\131\44\0" +
"\1\132\42\0\1\133\42\0\1\134\65\0\1\135\25\0" +
"\1\136\42\0\1\137\33\0\1\140\37\0\1\141\42\0" +
"\1\142\46\0\1\143\31\0\1\144\61\0\1\145\42\0" +
"\1\146\34\0\1\147\40\0\1\150\42\0\1\151\44\0" +
"\1\152\62\0\1\153\30\0\1\154\42\0\1\155\35\0" +
"\1\156\34\0\1\157\42\0\1\160\47\0\1\161\31\0" +
"\1\162\61\0\1\163\42\0\1\164\30\0\1\165\57\0" +
"\1\166\42\0\1\167\45\0\1\170\52\0\1\171\24\0" +
"\1\172\42\0\1\173\27\0\1\174\44\0\1\175\42\0" +
"\1\176\45\0\1\177\67\0\1\200\23\0\1\201\42\0" +
"\1\202\31\0\1\203\36\0\1\204\42\0\1\205\51\0" +
"\1\206\61\0\1\207\31\0\1\210\42\0\1\211\25\0" +
"\1\212\43\0\1\213\42\0\1\214\50\0\1\215\50\0" +
"\1\216\42\0\1\217\34\0\1\220\33\0\1\221\42\0" +
"\1\222\51\0\1\223\50\0\1\224\42\0\1\225\36\0" +
"\1\226\33\0\1\227\42\0\1\230\47\0\1\231\50\0" +
"\1\232\42\0\1\233\30\0\1\234\42\0\1\235\42\0" +
"\1\236\46\0\1\237\50\0\1\240\42\0\1\241\37\0" +
"\1\242\34\0\1\243\42\0\1\244\45\0\1\245\50\0" +
"\1\246\42\0\1\247\31\0\1\250\57\0\1\251\42\0" +
"\1\207\30\0\1\252\50\0\1\253\42\0\1\254\40\0" +
"\1\255\36\0\1\256\50\0\1\257\42\0\1\260\34\0" +
"\1\261\50\0\1\262\42\0\1\263\34\0\1\264\50\0" +
"\1\265\42\0\1\266\41\0\1\267\43\0\1\270\42\0" +
"\1\271\42\0\1\272\42\0\1\273\42\0\1\274\42\0" +
"\1\275\42\0\1\276\42\0\1\277\42\0\1\300\42\0" +
"\1\301\42\0\1\302\42\0\1\303\42\0\1\304\42\0" +
"\1\305\42\0\1\306\42\0\1\307\42\0\1\310\42\0" +
"\1\311\42\0\1\312\42\0\1\313\42\0\1\314\42\0" +
"\1\315\42\0\1\316\42\0\1\317\42\0\1\320\42\0" +
"\1\321\42\0\1\322\42\0\1\323\42\0\1\324\42\0" +
"\1\325\42\0\1\326\42\0\1\327\42\0\1\330\42\0" +
"\1\331\42\0\1\332\42\0\1\333\42\0\1\334\42\0" +
"\1\335\42\0\1\336\42\0\1\337\42\0\1\340\42\0" +
"\1\341\42\0\1\342\42\0\1\343\42\0\1\344\42\0" +
"\1\345\42\0\1\346\42\0\1\347\42\0\1\350\42\0" +
"\1\351\42\0\1\352\42\0\1\353\42\0\1\354\42\0" +
"\1\355\42\0\1\356\42\0\1\357\42\0\1\360\42\0" +
"\1\361\42\0\1\362\42\0\1\363\42\0\1\364\42\0" +
"\1\365\42\0\1\366\42\0\1\367\42\0\1\370\42\0" +
"\1\371\42\0\1\372\42\0\1\373\42\0\1\374\42\0" +
"\1\375\42\0\1\376\42\0\1\377\42\0\1\u0100\42\0" +
"\1\u0101\42\0\1\u0102\42\0\1\u0103\42\0\1\u0104\42\0" +
"\1\u0105\42\0\1\u0106\42\0\1\u0107\42\0\1\u0108\42\0" +
"\1\u0109\42\0\1\u010a\42\0\1\u010b\42\0\1\u010c\42\0" +
"\1\u010d\42\0\1\u010e\42\0\1\u010f\42\0\1\u0110\42\0" +
"\1\u0111\17\0";
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int[] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\12\0\1\11\23\1\23\0\3\1\122\0\1\11\41\0" +
"\1\11\3\0\1\11\11\0\1\11\130\0\2\11";
/* user code: */
public static boolean DEBUG = false;
/**
* the input device
*/
private java.io.Reader zzReader;
/**
* the current state of the DFA
*/
private int zzState;
/**
* the textposition at the last accepting state
*/
private int zzMarkedPos;
/**
* the current text position in the buffer
*/
private int zzCurrentPos;
/**
* startRead marks the beginning of the yytext() string in the buffer
*/
private int zzStartRead;
/**
* endRead marks the last character in the buffer, that has been read
* from input
*/
private int zzEndRead;
/**
* number of newlines encountered up to the start of the matched text
*/
private int yyline;
/**
* the number of characters up to the start of the matched text
*/
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/**
* zzAtEOF == true <=> the scanner is at the EOF
*/
private boolean zzAtEOF;
/**
* denotes if the user-EOF-code has already been executed
*/
private boolean zzEOFDone;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public FinalCoordLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public FinalCoordLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
private static int[] zzUnpackAction() {
int[] result = new int[273];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
private static int[] zzUnpackRowMap() {
int[] result = new int[273];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
private static int[] zzUnpackTrans() {
int[] result = new int[9030];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
private static int[] zzUnpackAttribute() {
int[] result = new int[273];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int[] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Runs the scanner on input files.
* <p/>
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java FinalCoordLexer <inputfile>");
} else {
for (int i = 0; i < argv.length; i++) {
FinalCoordLexer scanner = null;
try {
scanner = new FinalCoordLexer(new java.io.FileReader(argv[i]));
while (!scanner.zzAtEOF) scanner.next_token();
} catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \"" + argv[i] + "\"");
} catch (java.io.IOException e) {
System.out.println("IO error scanning file \"" + argv[i] + "\"");
System.out.println(e);
} catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
* @throws java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead - zzStartRead);
/* translate stored positions */
zzEndRead -= zzStartRead;
zzCurrentPos -= zzStartRead;
zzMarkedPos -= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos * 2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length - zzEndRead);
if (numRead > 0) {
zzEndRead += numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
* <p/>
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String(zzBuffer, zzStartRead, zzMarkedPos - zzStartRead);
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
* <p/>
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead + pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos - zzStartRead;
}
/**
* Reports an error that occured while scanning.
* <p/>
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
* <p/>
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
} catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
* <p/>
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if (number > yylength())
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @throws java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char[] zzBufferL = zzBuffer;
char[] zzCMapL = ZZ_CMAP;
int[] zzTransL = ZZ_TRANS;
int[] zzRowMapL = ZZ_ROWMAP;
int[] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction:
{
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
} else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
} else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[zzRowMapL[zzState] + zzCMapL[zzInput]];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ((zzAttributes & 1) == 1) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ((zzAttributes & 8) == 8) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 5: {
yybegin(INPUTD);
return new Symbol(FinalCoordSym.INPUT5, new Float(yytext()));
}
case 14:
break;
case 7: {
yybegin(INPUT);
return new Symbol(FinalCoordSym.INPUT7, new Float(yytext()));
}
case 15:
break;
case 3: {
yybegin(INPUTB);
return new Symbol(FinalCoordSym.INPUT3, new Integer(yytext()));
}
case 16:
break;
case 8: {
yybegin(IGNOREALL);
return new Symbol(FinalCoordSym.SCFDONE);
}
case 17:
break;
case 11: {
yybegin(INPUTF);
return new Symbol(FinalCoordSym.INPUT1);
}
case 18:
break;
case 2: {
yybegin(INPUTA);
return new Symbol(FinalCoordSym.INPUT2, new Integer(yytext()));
}
case 19:
break;
case 12: {
yybegin(ITER);
return new Symbol(FinalCoordSym.DASH2);
}
case 20:
break;
case 9: {
yybegin(ITER);
return new Symbol(FinalCoordSym.FOUNDITER);
}
case 21:
break;
case 10: {
yybegin(ITER);
return new Symbol(FinalCoordSym.FOUNDITER);
}
case 22:
break;
case 6: {
yybegin(INPUTE);
return new Symbol(FinalCoordSym.INPUT6, new Float(yytext()));
}
case 23:
break;
case 4: {
yybegin(INPUTC);
return new Symbol(FinalCoordSym.INPUT4, new Integer(yytext()));
}
case 24:
break;
case 13: {
yybegin(INPUT);
return new Symbol(FinalCoordSym.DASH1);
}
case 25:
break;
case 1: {
}
case 26:
break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{
return new java_cup.runtime.Symbol(FinalCoordSym.EOF);
}
} else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
* <p/>
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field[] classFields = FinalCoordSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
* <p/>
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println(" --" + yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
}
| 9,174 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gnumatom/GNumAtomLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gnumatom;/* The following code was generated by JFlex 1.4.3 on 9/11/14 5:20 PM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/11/14 5:20 PM from the specification file
* <tt>gnumatom.flex</tt>
*/
public class GNumAtomLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int IGNOREALL = 6;
public static final int ITER1 = 4;
public static final int YYINITIAL = 0;
public static final int ITER = 2;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 2, 2
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 4, 0, 0,
0, 7, 13, 0, 0, 14, 3, 0, 0, 0, 0, 0, 8, 12, 10, 6,
0, 0, 15, 16, 5, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\3\0\2\1\2\2\54\0\1\3";
private static int [] zzUnpackAction() {
int [] result = new int[52];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\21\0\42\0\63\0\104\0\63\0\125\0\146"+
"\0\167\0\210\0\231\0\252\0\273\0\314\0\335\0\356"+
"\0\377\0\u0110\0\u0121\0\u0132\0\u0143\0\u0154\0\u0165\0\u0176"+
"\0\u0187\0\u0198\0\u01a9\0\u01ba\0\u01cb\0\u01dc\0\u01ed\0\u01fe"+
"\0\u020f\0\u0220\0\u0231\0\u0242\0\u0253\0\u0264\0\u0275\0\u0286"+
"\0\u0297\0\u02a8\0\u02b9\0\u02ca\0\u02db\0\u02ec\0\u02fd\0\u030e"+
"\0\u031f\0\u0330\0\u0341\0\63";
private static int [] zzUnpackRowMap() {
int [] result = new int[52];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\5\4\1\5\14\4\1\6\1\7\37\4\27\0\1\10"+
"\13\0\2\7\23\0\1\11\22\0\1\12\21\0\1\13"+
"\21\0\1\14\21\0\1\15\21\0\1\16\21\0\1\17"+
"\21\0\1\20\21\0\1\21\21\0\1\22\12\0\1\23"+
"\15\0\1\24\15\0\1\25\26\0\1\26\16\0\1\27"+
"\16\0\1\30\21\0\1\31\26\0\1\32\24\0\1\33"+
"\11\0\1\34\20\0\1\35\20\0\1\36\20\0\1\37"+
"\20\0\1\40\20\0\1\41\20\0\1\42\20\0\1\43"+
"\20\0\1\44\20\0\1\45\20\0\1\46\20\0\1\47"+
"\20\0\1\50\20\0\1\51\20\0\1\52\20\0\1\53"+
"\20\0\1\54\20\0\1\55\20\0\1\56\20\0\1\57"+
"\20\0\1\60\20\0\1\61\20\0\1\62\20\0\1\63"+
"\13\0\1\64\14\0";
private static int [] zzUnpackTrans() {
int [] result = new int[850];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\3\0\1\11\1\1\1\11\1\1\54\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[52];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public GNumAtomLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public GNumAtomLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 2:
{ if (Settings.DEBUG) System.out.println("GNumAtomFlex: Found total # of atoms ");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GNumAtomSym.RUNTYP);
}
case 4: break;
case 3:
{ if (Settings.DEBUG) System.out.println("GNumAtomFlex: Found Gamess Version");
yybegin(ITER);
return new Symbol(GNumAtomSym.FOUNDITER);
}
case 5: break;
case 1:
{
}
case 6: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(GNumAtomSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = GNumAtomSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java GNumAtomLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
GNumAtomLexer scanner = null;
try {
scanner = new GNumAtomLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,175 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gnumatom/GNumAtomSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gnumatom;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Thu Sep 11 17:20:46 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class GNumAtomSym {
/* terminals */
public static final int RUNTYP = 4;
public static final int SCFDONE = 3;
public static final int error = 1;
public static final int FOUNDITER = 2;
public static final int RUNTYP1 = 5;
public static final int EOF = 0;
}
| 9,176 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gnumatom/GNumAtomParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gnumatom;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import java.io.FileReader;
import java.util.HashMap;
public class GNumAtomParser extends java_cup.runtime.lr_parser implements GridChemQueueParser{
/** Default constructor. */
public GNumAtomParser() {super();}
/** Constructor which sets the default scanner. */
public GNumAtomParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public GNumAtomParser(final FileReader fileReader) {
super(new GNumAtomLexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\003\000\002\003\003\000\002\002\004\000\002\004" +
"\004"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\006\000\004\004\005\001\002\000\004\002\001\001" +
"\002\000\004\006\010\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\004\002\uffff\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\006\000\006\003\005\004\003\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
return null;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private final GNumAtomParser GNumAtomParser;
/** Constructor */
CUP$parser$actions(GNumAtomParser GNumAtomParser) {
this.GNumAtomParser = GNumAtomParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER RUNTYP
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:GNUMatom: found FOUNDITER ");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:GNUMatom: end of parse tree ");
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,177 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gvb/GVBLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gvb;/* The following code was generated by JFlex 1.4.3 on 9/11/14 6:26 PM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/11/14 6:26 PM from the specification file
* <tt>gvb.flex</tt>
*/
public class GVBLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int ITER2 = 6;
public static final int DASH = 10;
public static final int INTVALUE = 12;
public static final int SCF1 = 2;
public static final int IGNOREALL = 24;
public static final int ITER = 4;
public static final int YYINITIAL = 0;
public static final int ITER8 = 8;
public static final int ITER7 = 22;
public static final int ITER6 = 20;
public static final int ITER5 = 18;
public static final int FLOATVALUE = 14;
public static final int ITER4 = 16;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 1, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 1, 1
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 24, 4, 0,
1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0,
0, 13, 23, 18, 22, 8, 5, 16, 19, 6, 0, 0, 14, 0, 15, 12,
0, 21, 9, 20, 7, 0, 25, 0, 11, 17, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\13\0\2\1\2\2\1\1\2\3\3\1\3\4\10\1"+
"\5\0\1\5\13\0\1\6\2\0\1\7\1\10\1\11"+
"\1\12\65\0\1\13\1\14\1\15\62\0\1\16";
private static int [] zzUnpackAction() {
int [] result = new int[163];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\32\0\64\0\116\0\150\0\202\0\234\0\266"+
"\0\320\0\352\0\u0104\0\u011e\0\u0138\0\u011e\0\u0152\0\u016c"+
"\0\u011e\0\u0186\0\u01a0\0\u01ba\0\u01d4\0\u011e\0\u01ee\0\u0208"+
"\0\u0222\0\u023c\0\u0256\0\u0270\0\u028a\0\u02a4\0\u02be\0\u02d8"+
"\0\u02f2\0\u030c\0\u01a0\0\u0326\0\u0340\0\u01ee\0\u035a\0\u0222"+
"\0\u0374\0\u0256\0\u038e\0\u028a\0\u03a8\0\u02be\0\u03c2\0\u03dc"+
"\0\u03f6\0\u0326\0\u0410\0\u042a\0\u0374\0\u038e\0\u03a8\0\u03c2"+
"\0\u0444\0\u045e\0\u0478\0\u0492\0\u04ac\0\u04c6\0\u04e0\0\u04fa"+
"\0\u0514\0\u052e\0\u0548\0\u0562\0\u057c\0\u0596\0\u05b0\0\u05ca"+
"\0\u05e4\0\u05fe\0\u0618\0\u0632\0\u064c\0\u0666\0\u0680\0\u069a"+
"\0\u06b4\0\u06ce\0\u06e8\0\u0702\0\u071c\0\u0736\0\u0750\0\u076a"+
"\0\u0784\0\u079e\0\u07b8\0\u07d2\0\u07ec\0\u0806\0\u0820\0\u083a"+
"\0\u0854\0\u086e\0\u0888\0\u08a2\0\u08bc\0\u08d6\0\u08f0\0\u090a"+
"\0\u0924\0\u093e\0\u0958\0\u0972\0\u098c\0\u011e\0\u011e\0\u011e"+
"\0\u09a6\0\u09c0\0\u09da\0\u09f4\0\u0a0e\0\u0a28\0\u0a42\0\u0a5c"+
"\0\u0a76\0\u0a90\0\u0aaa\0\u0ac4\0\u0ade\0\u0af8\0\u0b12\0\u0b2c"+
"\0\u0b46\0\u0b60\0\u0b7a\0\u0b94\0\u0bae\0\u0bc8\0\u0be2\0\u0bfc"+
"\0\u0c16\0\u0c30\0\u0c4a\0\u0c64\0\u0c7e\0\u0c98\0\u0cb2\0\u0ccc"+
"\0\u0ce6\0\u0d00\0\u0d1a\0\u0d34\0\u0d4e\0\u0d68\0\u0d82\0\u0d9c"+
"\0\u0db6\0\u0dd0\0\u0dea\0\u0e04\0\u0e1e\0\u0e38\0\u0e52\0\u0e6c"+
"\0\u0e86\0\u0ea0\0\u011e";
private static int [] zzUnpackRowMap() {
int [] result = new int[163];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\6\14\1\15\56\14\1\16\1\17\25\14\1\20\2\14"+
"\1\21\1\22\30\14\2\23\1\24\24\14\1\24\27\14"+
"\1\25\3\14\1\26\3\27\24\26\1\30\1\26\1\14"+
"\2\31\1\32\24\14\1\32\2\14\2\33\1\34\24\14"+
"\1\34\2\14\2\35\1\36\24\14\1\36\2\14\2\37"+
"\1\40\24\14\1\40\1\14\41\0\1\41\23\0\2\17"+
"\57\0\1\42\2\0\2\22\30\0\2\43\1\0\1\44"+
"\26\0\2\43\37\0\1\45\22\0\2\46\30\0\2\46"+
"\25\0\1\47\2\0\2\50\1\0\1\51\26\0\2\50"+
"\30\0\2\52\1\0\1\53\26\0\2\52\30\0\2\54"+
"\1\0\1\55\26\0\2\54\30\0\2\56\1\0\1\57"+
"\26\0\2\56\37\0\1\60\51\0\1\61\2\0\2\62"+
"\46\0\1\63\42\0\1\64\2\0\2\65\30\0\2\66"+
"\30\0\2\67\30\0\2\70\40\0\1\71\50\0\1\72"+
"\25\0\1\73\35\0\1\74\13\0\1\75\47\0\1\76"+
"\7\0\1\77\53\0\1\100\11\0\1\101\51\0\1\102"+
"\10\0\1\103\52\0\1\104\14\0\1\105\46\0\1\106"+
"\22\0\1\107\40\0\1\110\13\0\1\111\47\0\1\112"+
"\13\0\1\113\47\0\1\114\13\0\1\115\47\0\1\116"+
"\23\0\1\117\37\0\1\120\13\0\1\121\47\0\1\122"+
"\15\0\1\123\45\0\1\124\13\0\1\125\47\0\1\126"+
"\20\0\1\127\42\0\1\130\13\0\1\131\47\0\1\132"+
"\32\0\1\133\30\0\1\134\10\0\1\135\52\0\1\136"+
"\11\0\1\137\51\0\1\140\15\0\1\141\45\0\1\142"+
"\12\0\1\143\50\0\1\144\10\0\1\145\52\0\1\146"+
"\21\0\1\147\41\0\1\150\16\0\1\151\44\0\1\152"+
"\11\0\1\153\51\0\1\154\17\0\1\155\43\0\1\156"+
"\27\0\1\157\33\0\1\160\13\0\1\161\27\0\1\162"+
"\40\0\1\163\22\0\1\164\32\0\1\165\40\0\1\166"+
"\32\0\1\167\22\0\1\170\31\0\1\171\31\0\1\172"+
"\31\0\1\173\31\0\1\174\31\0\1\175\31\0\1\176"+
"\27\0\1\177\33\0\1\200\41\0\1\201\32\0\1\202"+
"\23\0\1\203\33\0\1\204\32\0\1\205\21\0\1\206"+
"\33\0\1\207\31\0\1\210\31\0\1\211\31\0\1\212"+
"\31\0\1\213\31\0\1\214\31\0\1\215\31\0\1\216"+
"\43\0\1\217\32\0\1\220\26\0\1\221\35\0\1\222"+
"\10\0\1\223\36\0\1\224\31\0\1\225\31\0\1\226"+
"\31\0\1\227\31\0\1\230\31\0\1\231\31\0\1\232"+
"\33\0\1\233\26\0\1\234\47\0\1\235\6\0\1\236"+
"\37\0\1\237\37\0\1\240\22\0\1\241\35\0\1\242"+
"\42\0\1\243\3\0";
private static int [] zzUnpackTrans() {
int [] result = new int[3770];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\13\0\1\11\1\1\1\11\2\1\1\11\4\1\1\11"+
"\12\1\5\0\1\1\13\0\1\1\2\0\4\1\65\0"+
"\3\11\62\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[163];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public GVBLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public GVBLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 10:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found float3");
yybegin(ITER);
return new Symbol(GVBSym.FLOAT3);
}
case 15: break;
case 11:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found the dash");
yybegin(DASH);
}
case 16: break;
case 13:
{ yybegin(DASH);
}
case 17: break;
case 14:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found START OF");
yybegin(ITER);
return new Symbol(GVBSym.FOUNDITER);
}
case 18: break;
case 7:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found the energy");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER5);
return new Symbol(GVBSym.ENERGY, new Float(yytext()));
}
case 19: break;
case 6:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found float4");
yybegin(ITER);
return new Symbol(GVBSym.FLOAT4);
}
case 20: break;
case 12:
{ yybegin(IGNOREALL);
return new Symbol(GVBSym.SCFDONE);
}
case 21: break;
case 9:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found float2");
yybegin (ITER7);
return new Symbol(GVBSym.FLOAT2);
}
case 22: break;
case 2:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found the first integer in the iteration");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER2);
return new Symbol(GVBSym.INTCycle, new Integer(yytext()));
}
case 23: break;
case 8:
{ if (Settings.DEBUG) System.out.println("GVBFlex: ITER5");
if (Settings.DEBUG) System.out.println("GVBFlex: Found float1");
yybegin (ITER6);
return new Symbol(GVBSym.FLOAT1);
}
case 24: break;
case 5:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found float value");
yybegin(ITER);
}
case 25: break;
case 4:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found new line");
}
case 26: break;
case 1:
{
}
case 27: break;
case 3:
{ if (Settings.DEBUG) System.out.println("GVBFlex: Found the second integer in the iteration"); if (Settings.DEBUG) System.out.println(yytext()); yybegin(ITER4); return new Symbol(GVBSym.INT1, new Integer(yytext()));
}
case 28: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(GVBSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = GVBSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java GVBLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
GVBLexer scanner = null;
try {
scanner = new GVBLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,178 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gvb/GVBParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gvb;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import javax.swing.*;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
public class GVBParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public GVBParser() {super();}
/** Constructor which sets the default scanner. */
public GVBParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public GVBParser(final FileReader fileReader) {
super(new GVBLexer(fileReader));
}
/** Production table. */
protected static final short[][] _production_table =
lr_parser.unpackFromStrings(new String[]{
"\000\010\000\002\003\005\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\010\002" +
"\000\002\006\011\000\002\007\003"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\021\000\004\004\005\001\002\000\004\011\012\001" +
"\002\000\004\011\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\006\005\022\011\012\001" +
"\002\000\006\005\ufffd\011\ufffd\001\002\000\004\006\ufffc" +
"\001\002\000\004\006\014\001\002\000\004\016\016\001" +
"\002\000\004\013\017\001\002\000\004\013\ufffa\001\002" +
"\000\004\014\020\001\002\000\004\015\021\001\002\000" +
"\006\005\ufffb\011\ufffb\001\002\000\004\002\001\001\002" +
"\000\006\005\ufffe\011\ufffe\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\021\000\006\003\005\004\003\001\001\000\006\005" +
"\007\006\010\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\004\006\022\001\001\000\002\001" +
"\001\000\004\010\012\001\001\000\002\001\001\000\004" +
"\007\014\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
//Each string is of the format
//energy and iteraction
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results= new HashMap<String,String>();
int energyCount=0;
int iterationCount=0;
for(int i=0;i<result.size();i++){
String singleString= result.get(i);
String[] temp=singleString.split(" ");
if(temp.length>1){
String keyString=temp[0];
String dataString=temp[1];
if(keyString.equals("ENERGY")){
results.put("GVBParser_ENERGY_"+energyCount,dataString);
energyCount++;
}else if(keyString.equals("ITERATION")){
results.put("GVBParser_ITERATION_"+iterationCount,dataString);
iterationCount++;
}
}
}
return results;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private static JTable table;
private static final String tableLabel = "SCF Intermediate Results:";
// private static String cycle = "0";
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
/* public static void main(String[] args) throws IOException {
File temp = new File("temporary");
boolean append = true;
try{
FileWriter temp1 = new FileWriter(temp, append);
PrintWriter temp2 = new PrintWriter(temp1);}
catch (FileNotFoundException e) {
System.out.println("no file, dude!");
} */
// }
private final GVBParser GVBParser;
/** Constructor */
CUP$parser$actions(GVBParser GVBParser) {
this.GVBParser = GVBParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // en ::= ENERGY
{
Object RESULT = null;
int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float e = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gscfa:scfcycle: ENERGY "+e);
GVBParser.addToResult("ENERGY "+e);
// temp2.println(e);
// parseSCF.putField("iteration "+cycle, "energy", e);
CUP$parser$result = new java_cup.runtime.Symbol(5/*en*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // scfcycle ::= INTCycle NT$0 INT1 en FLOAT1 FLOAT2 FLOAT3
{
Object RESULT = null;
// propagate RESULT from NT$0
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-6)).value;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // NT$0 ::=
{
Object RESULT = null;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gscfa:scfcycle: ITERATION "+c);
GVBParser.addToResult("ITERATION "+c);
// temp2.print(c);
// temp2.print(" ");
// cycle = c;
// parseSCF.putField("iteration "+cycle, cycle);
CUP$parser$result = new java_cup.runtime.Symbol(6/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gscfa: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gscfa: found start of SCF Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gscfa: end of parse tree ");
table = new JTable();
// table = parseSCF.getTable();
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,179 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gvb/GVBSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gvb;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Thu Sep 11 18:26:09 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class GVBSym {
/* terminals */
public static final int INTCycle = 7;
public static final int ENERGY = 12;
public static final int EOF = 0;
public static final int INT3 = 6;
public static final int INT2 = 5;
public static final int INT1 = 4;
public static final int error = 1;
public static final int FLOAT4 = 13;
public static final int FLOAT3 = 11;
public static final int FLOAT2 = 10;
public static final int SCFDONE = 3;
public static final int FLOAT1 = 9;
public static final int FOUNDITER = 2;
public static final int FLOAT = 8;
}
| 9,180 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/g1/G1Sym.java |
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.g1;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Wed Sep 10 08:33:37 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class G1Sym {
/* terminals */
public static final int ENERGY1 = 16;
public static final int MPMGRAD = 20;
public static final int MGRAD1 = 17;
public static final int MaxGrad1 = 6;
public static final int NSearch1 = 4;
public static final int MPRGRAD = 21;
public static final int MPRms = 12;
public static final int RmsGrad1 = 7;
public static final int MPMax = 11;
public static final int MPDONE = 13;
public static final int EOF = 0;
public static final int MPENERGY = 19;
public static final int ITERATION1 = 14;
public static final int NMP = 9;
public static final int MPEnerg = 10;
public static final int error = 1;
public static final int MPITER = 15;
public static final int MPStart = 8;
public static final int FOUNDITER1 = 2;
public static final int Energ1 = 5;
public static final int SCFDONE1 = 3;
public static final int RGRAD1 = 18;
}
| 9,181 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/g1/G1Lexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.g1;/* The following code was generated by JFlex 1.4.3 on 9/10/14 8:33 AM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/10/14 8:33 AM from the specification file
* <tt>g1.flex</tt>
*/
public class G1Lexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int FLOATMP3 = 24;
public static final int ITER2 = 4;
public static final int FLOATMP2 = 22;
public static final int FLOATMP1 = 20;
public static final int MPOPT = 18;
public static final int INTMP = 28;
public static final int INTVALUE = 8;
public static final int IGNOREALL = 26;
public static final int ITER = 2;
public static final int YYINITIAL = 0;
public static final int MP2 = 16;
public static final int FLOAT2 = 14;
public static final int FLOAT1 = 12;
public static final int FLOATVALUE = 10;
public static final int ITER3 = 6;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 2, 2, 12, 12
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
14, 0, 0, 0, 0, 0, 0, 0, 29, 7, 0, 3, 0, 46, 4, 1,
2, 48, 44, 47, 2, 2, 45, 2, 2, 2, 27, 0, 0, 6, 0, 0,
0, 0, 0, 24, 26, 28, 25, 49, 31, 41, 0, 0, 42, 32, 8, 36,
43, 0, 30, 23, 5, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40,
0, 33, 11, 35, 39, 12, 16, 0, 22, 20, 0, 0, 38, 10, 21, 15,
19, 0, 13, 17, 18, 9, 0, 0, 34, 0, 37, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\15\0\7\1\1\2\25\1\1\3\1\1\42\0\1\4"+
"\1\5\1\6\10\0\1\7\1\10\1\11\107\0\1\12"+
"\41\0\1\13\7\0\1\14\22\0\1\15\1\16\4\0"+
"\1\17\1\20\12\0\1\21\2\0\1\22\1\0\1\23"+
"\16\0\1\24\2\0\1\25\11\0\1\26\1\27\4\0"+
"\1\30";
private static int [] zzUnpackAction() {
int [] result = new int[282];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\63\0\146\0\231\0\314\0\377\0\u0132\0\u0165"+
"\0\u0198\0\u01cb\0\u01fe\0\u0231\0\u0264\0\u0297\0\u02ca\0\u02fd"+
"\0\u0330\0\u0363\0\u0396\0\u03c9\0\u03fc\0\u03fc\0\u042f\0\u0462"+
"\0\u0495\0\u04c8\0\u04fb\0\u052e\0\u0561\0\u0594\0\u05c7\0\u05fa"+
"\0\u062d\0\u0660\0\u0693\0\u06c6\0\u06f9\0\u072c\0\u075f\0\u0792"+
"\0\u07c5\0\u07f8\0\u082b\0\u082b\0\u085e\0\u0891\0\u08c4\0\u08f7"+
"\0\u092a\0\u095d\0\u0990\0\u042f\0\u09c3\0\u0495\0\u09f6\0\u04fb"+
"\0\u0a29\0\u0a5c\0\u0a8f\0\u0ac2\0\u0af5\0\u0b28\0\u0b5b\0\u0b8e"+
"\0\u0bc1\0\u06f9\0\u0bf4\0\u075f\0\u0c27\0\u07c5\0\u0c5a\0\u0c8d"+
"\0\u0cc0\0\u0cf3\0\u0d26\0\u0d59\0\u0d8c\0\u0dbf\0\u09c3\0\u09f6"+
"\0\u0a29\0\u0df2\0\u0e25\0\u0e58\0\u0e8b\0\u0ebe\0\u0ef1\0\u0f24"+
"\0\u0f57\0\u0bf4\0\u0c27\0\u0c5a\0\u0f8a\0\u0fbd\0\u0ff0\0\u1023"+
"\0\u1056\0\u1089\0\u10bc\0\u10ef\0\u1122\0\u1155\0\u1188\0\u11bb"+
"\0\u11ee\0\u1221\0\u1254\0\u1287\0\u12ba\0\u12ed\0\u1320\0\u1353"+
"\0\u1386\0\u13b9\0\u13ec\0\u141f\0\u1452\0\u1485\0\u14b8\0\u14eb"+
"\0\u151e\0\u1551\0\u1584\0\u15b7\0\u15ea\0\u161d\0\u1650\0\u1683"+
"\0\u16b6\0\u16e9\0\u171c\0\u174f\0\u1782\0\u17b5\0\u17e8\0\u181b"+
"\0\u184e\0\u1881\0\u18b4\0\u18e7\0\u191a\0\u194d\0\u1980\0\u19b3"+
"\0\u19e6\0\u1a19\0\u1a4c\0\u1a7f\0\u1ab2\0\u1ae5\0\u1b18\0\u1b4b"+
"\0\u1b7e\0\u1bb1\0\u1be4\0\u1c17\0\u1c4a\0\u1c7d\0\u1cb0\0\u1ce3"+
"\0\u1d16\0\u1d49\0\u1d7c\0\u0297\0\u1daf\0\u1de2\0\u1e15\0\u1e48"+
"\0\u1e7b\0\u1eae\0\u1ee1\0\u1f14\0\u1f47\0\u1f7a\0\u1fad\0\u1fe0"+
"\0\u2013\0\u2046\0\u2079\0\u20ac\0\u20df\0\u2112\0\u2145\0\u2178"+
"\0\u21ab\0\u21de\0\u2211\0\u2244\0\u2277\0\u22aa\0\u22dd\0\u2310"+
"\0\u2343\0\u2376\0\u23a9\0\u23dc\0\u240f\0\u0297\0\u2442\0\u2475"+
"\0\u24a8\0\u24db\0\u250e\0\u2541\0\u2574\0\u0297\0\u25a7\0\u25da"+
"\0\u260d\0\u2640\0\u2673\0\u26a6\0\u26d9\0\u270c\0\u273f\0\u2772"+
"\0\u27a5\0\u27d8\0\u280b\0\u283e\0\u2871\0\u28a4\0\u28d7\0\u290a"+
"\0\u0297\0\u0297\0\u293d\0\u2970\0\u29a3\0\u29d6\0\u0297\0\u0297"+
"\0\u2a09\0\u2a3c\0\u2a6f\0\u2aa2\0\u2ad5\0\u2b08\0\u2b3b\0\u2b6e"+
"\0\u2ba1\0\u2bd4\0\u0297\0\u2c07\0\u2c3a\0\u0297\0\u2c6d\0\u0297"+
"\0\u2ca0\0\u2cd3\0\u2d06\0\u2d39\0\u2d6c\0\u2d9f\0\u2dd2\0\u2e05"+
"\0\u2e38\0\u2e6b\0\u2e9e\0\u2ed1\0\u2f04\0\u2f37\0\u0297\0\u2f6a"+
"\0\u2f9d\0\u0297\0\u2fd0\0\u3003\0\u3036\0\u3069\0\u309c\0\u30cf"+
"\0\u3102\0\u3135\0\u3168\0\u0297\0\u0297\0\u319b\0\u31ce\0\u3201"+
"\0\u3234\0\u0297";
private static int [] zzUnpackRowMap() {
int [] result = new int[282];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\10\16\1\17\57\16\1\20\21\16\1\21\6\16\1\22"+
"\1\16\1\23\3\16\1\24\103\16\1\25\1\26\50\16"+
"\2\25\1\26\2\25\4\16\1\27\1\30\50\16\2\27"+
"\1\30\2\27\4\16\1\31\1\32\50\16\2\31\1\32"+
"\2\31\4\16\1\33\1\34\50\16\2\33\1\34\2\33"+
"\7\16\1\35\32\16\1\36\27\16\1\37\21\16\1\40"+
"\4\16\1\41\1\16\1\42\1\16\1\43\3\16\1\44"+
"\20\16\1\45\1\46\50\16\2\45\1\46\2\45\4\16"+
"\1\47\1\50\50\16\2\47\1\50\2\47\4\16\1\51"+
"\1\52\50\16\2\51\1\52\2\51\4\16\1\53\1\54"+
"\50\16\2\53\1\54\2\53\2\16\74\0\1\55\110\0"+
"\1\56\45\0\1\57\5\0\1\60\72\0\1\61\63\0"+
"\1\62\44\0\1\63\41\0\1\25\51\0\2\25\1\0"+
"\2\25\4\0\1\64\1\0\1\65\47\0\2\64\1\0"+
"\2\64\4\0\1\64\51\0\2\64\1\0\2\64\4\0"+
"\1\66\1\0\1\67\47\0\2\66\1\0\2\66\4\0"+
"\1\66\51\0\2\66\1\0\2\66\4\0\1\70\1\0"+
"\1\71\47\0\2\70\1\0\2\70\4\0\1\70\51\0"+
"\2\70\1\0\2\70\41\0\1\72\76\0\1\73\46\0"+
"\1\74\45\0\1\75\122\0\1\76\40\0\1\77\63\0"+
"\1\100\44\0\1\101\41\0\1\102\1\0\1\103\47\0"+
"\2\102\1\0\2\102\4\0\1\102\51\0\2\102\1\0"+
"\2\102\4\0\1\104\1\0\1\105\47\0\2\104\1\0"+
"\2\104\4\0\1\104\51\0\2\104\1\0\2\104\4\0"+
"\1\106\1\0\1\107\47\0\2\106\1\0\2\106\4\0"+
"\1\106\51\0\2\106\1\0\2\106\4\0\1\53\51\0"+
"\2\53\1\0\2\53\14\0\1\110\104\0\1\111\42\0"+
"\1\112\77\0\1\113\60\0\1\114\75\0\1\115\42\0"+
"\1\116\42\0\1\117\51\0\2\117\1\0\2\117\4\0"+
"\1\120\51\0\2\120\1\0\2\120\4\0\1\121\51\0"+
"\2\121\1\0\2\121\36\0\1\122\102\0\1\123\42\0"+
"\1\124\42\0\1\125\106\0\1\126\51\0\1\127\75\0"+
"\1\130\42\0\1\131\42\0\1\132\51\0\2\132\1\0"+
"\2\132\4\0\1\133\51\0\2\133\1\0\2\133\4\0"+
"\1\134\51\0\2\134\1\0\2\134\15\0\1\135\117\0"+
"\1\136\35\0\1\137\55\0\1\140\62\0\1\141\70\0"+
"\1\142\62\0\1\143\106\0\1\144\47\0\1\145\75\0"+
"\1\146\35\0\1\147\112\0\1\150\25\0\1\151\70\0"+
"\1\152\62\0\1\153\52\0\1\154\102\0\1\155\44\0"+
"\1\156\76\0\1\157\46\0\1\160\56\0\1\161\62\0"+
"\1\162\104\0\1\163\57\0\1\164\65\0\1\165\44\0"+
"\1\166\120\0\1\167\24\0\1\170\56\0\1\171\62\0"+
"\1\172\65\0\1\173\55\0\1\174\77\0\1\175\54\0"+
"\1\176\61\0\1\177\55\0\1\200\75\0\1\201\46\0"+
"\1\202\63\0\1\203\61\0\1\204\77\0\1\205\53\0"+
"\1\206\62\0\1\207\55\0\1\210\75\0\1\211\54\0"+
"\1\212\76\0\1\213\41\0\1\214\76\0\1\215\53\0"+
"\1\216\56\0\1\217\115\0\1\220\47\0\1\221\76\0"+
"\1\222\46\0\1\223\41\0\1\224\57\0\1\225\72\0"+
"\1\226\56\0\1\227\115\0\1\230\34\0\1\231\113\0"+
"\1\232\24\0\1\233\64\0\1\234\64\0\1\235\62\0"+
"\1\236\105\0\1\237\71\0\1\240\60\0\1\241\64\0"+
"\1\242\24\0\1\243\66\0\1\244\62\0\1\245\62\0"+
"\1\246\105\0\1\247\41\0\1\250\106\0\1\251\31\0"+
"\1\252\102\0\1\253\60\0\1\254\62\0\1\255\53\0"+
"\1\256\104\0\1\257\25\0\1\260\117\0\1\261\31\0"+
"\1\262\100\0\1\263\62\0\1\264\53\0\1\265\56\0"+
"\1\266\75\0\1\267\45\0\1\270\64\0\1\271\63\0"+
"\1\272\62\0\1\273\67\0\1\274\67\0\1\275\32\0"+
"\1\276\112\0\1\277\45\0\1\300\65\0\1\301\62\0"+
"\1\302\67\0\1\303\57\0\1\304\111\0\1\305\27\0"+
"\1\306\63\0\1\307\61\0\1\310\62\0\1\311\64\0"+
"\1\312\113\0\1\313\67\0\1\314\55\0\1\315\27\0"+
"\1\316\62\0\1\317\62\0\1\320\64\0\1\321\65\0"+
"\1\322\71\0\1\323\65\0\1\324\71\0\1\325\62\0"+
"\1\326\44\0\1\327\66\0\1\330\107\0\1\331\35\0"+
"\1\332\74\0\1\333\62\0\1\334\44\0\1\335\51\0"+
"\1\336\117\0\1\337\46\0\1\340\41\0\1\341\62\0"+
"\1\342\64\0\1\343\115\0\1\344\70\0\1\345\54\0"+
"\1\346\25\0\1\347\62\0\1\350\64\0\1\351\67\0"+
"\1\352\111\0\1\353\46\0\1\354\67\0\1\355\71\0"+
"\1\356\70\0\1\357\54\0\1\360\53\0\1\361\40\0"+
"\1\362\75\0\1\363\65\0\1\364\42\0\1\365\77\0"+
"\1\366\107\0\1\367\35\0\1\370\45\0\1\371\61\0"+
"\1\372\75\0\1\373\43\0\1\374\105\0\1\375\37\0"+
"\1\376\74\0\1\377\45\0\1\u0100\76\0\1\u0101\106\0"+
"\1\u0102\36\0\1\u0103\64\0\1\u0104\53\0\1\u0105\112\0"+
"\1\u0106\23\0\1\u0107\121\0\1\u0108\32\0\1\u0109\52\0"+
"\1\u010a\70\0\1\u010b\62\0\1\u010c\70\0\1\u010d\62\0"+
"\1\u010e\62\0\1\u010f\66\0\1\u0110\50\0\1\u0111\62\0"+
"\1\u0112\72\0\1\u0113\105\0\1\u0114\62\0\1\u0115\34\0"+
"\1\u0116\57\0\1\u0117\61\0\1\u0118\56\0\1\u0119\76\0"+
"\1\u011a\35\0";
private static int [] zzUnpackTrans() {
int [] result = new int[12903];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\15\0\1\11\36\1\42\0\3\1\10\0\3\1\107\0"+
"\1\11\41\0\1\11\7\0\1\11\22\0\2\11\4\0"+
"\2\11\12\0\1\11\2\0\1\11\1\0\1\11\16\0"+
"\1\11\2\0\1\11\11\0\2\11\4\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[282];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public G1Lexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public G1Lexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 23:
{ yybegin(IGNOREALL);
return new Symbol(G1Sym.MPDONE);
}
case 25: break;
case 4:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the energy in FLOATVALUE");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER);
return new Symbol(G1Sym.ENERGY1, new Float(yytext()));
}
case 26: break;
case 2:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found iteration");
if (Settings.DEBUG) System.out.println(yytext());
yybegin (ITER);
return new Symbol(G1Sym.ITERATION1, new Integer(yytext()));
}
case 27: break;
case 22:
{ if (Settings.DEBUG) System.out.println("G1Flex: SCFDONE1, Optimization completed");
yybegin(MP2);
return new Symbol(G1Sym.SCFDONE1);
}
case 28: break;
case 17:
{ if (Settings.DEBUG) System.out.println("G1Flex: SCFDONE1, THE_END_OF_FILE");
yybegin(MP2);
return new Symbol(G1Sym.SCFDONE1);
}
case 29: break;
case 12:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the Step number for MP");
yybegin(INTMP);
return new Symbol(G1Sym.NMP);
}
case 30: break;
case 24:
{ if (Settings.DEBUG) System.out.println("G1lex: Found Number of steps");
yybegin(ITER);
return new Symbol(G1Sym.FOUNDITER1);
}
case 31: break;
case 11:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the Step number");
yybegin(INTVALUE);
return new Symbol(G1Sym.NSearch1);
}
case 32: break;
case 9:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the RMS force");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(MPOPT);
return new Symbol(G1Sym.MPRGRAD, new Float(yytext()));
}
case 33: break;
case 3:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found iteration");
if (Settings.DEBUG) System.out.println(yytext());
yybegin (MPOPT);
return new Symbol(G1Sym.MPITER, new Integer(yytext()));
}
case 34: break;
case 21:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the energy in ITER");
yybegin(FLOATVALUE);
return new Symbol(G1Sym.Energ1);
}
case 35: break;
case 19:
{ if (Settings.DEBUG) System.out.println("G1Flex: MPDONE, THE_END_OF_FILE");
yybegin(IGNOREALL);
return new Symbol(G1Sym.MPDONE);
}
case 36: break;
case 10:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found MP2 energy");
yybegin(FLOATMP1);
return new Symbol(G1Sym.MPEnerg);
}
case 37: break;
case 20:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found MP2(Full)");
yybegin(MPOPT);
return new Symbol(G1Sym.MPStart);
}
case 38: break;
case 8:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the maximum force");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(MPOPT);
return new Symbol(G1Sym.MPMGRAD, new Float(yytext()));
}
case 39: break;
case 14:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found Maximum Force");
yybegin(FLOAT1);
return new Symbol(G1Sym.MaxGrad1);
}
case 40: break;
case 5:
{ if (Settings.DEBUG) System.out.println("G1lex: Found the maximum force");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER);
return new Symbol(G1Sym.MGRAD1, new Float(yytext()));
}
case 41: break;
case 15:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found RMS Force");
yybegin(FLOATMP3);
return new Symbol(G1Sym.MPRms);
}
case 42: break;
case 16:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found Maximum Force");
yybegin(FLOATMP2);
return new Symbol(G1Sym.MPMax);
}
case 43: break;
case 7:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the energy");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(MPOPT);
return new Symbol(G1Sym.MPENERGY, new Float(yytext()));
}
case 44: break;
case 6:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found the RMS force");
if (Settings.DEBUG) System.out.println(yytext());
yybegin(ITER);
return new Symbol(G1Sym.RGRAD1, new Float(yytext()));
}
case 45: break;
case 13:
{ if (Settings.DEBUG) System.out.println("G1Flex: Found RMS Force");
yybegin(FLOAT2);
return new Symbol(G1Sym.RmsGrad1);
}
case 46: break;
case 18:
{ if (Settings.DEBUG) System.out.println("G1Flex: MPStart, THE_END_OF_FILE");
yybegin(MPOPT);
return new Symbol(G1Sym.MPStart);
}
case 47: break;
case 1:
{
}
case 48: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(G1Sym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = G1Sym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java G1Lexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
G1Lexer scanner = null;
try {
scanner = new G1Lexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,182 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/g1/G1Parser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.g1;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import javax.swing.*;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
public class G1Parser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public G1Parser() {super();}
/** Constructor which sets the default scanner. */
public G1Parser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public G1Parser(final FileReader fileReader) {
super(new G1Lexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\025\000\002\003\007\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\021\002" +
"\000\002\006\006\000\002\022\002\000\002\007\007\000" +
"\002\010\004\000\002\011\004\000\002\012\004\000\002" +
"\013\003\000\002\014\004\000\002\014\003\000\002\023" +
"\002\000\002\016\006\000\002\024\002\000\002\015\007" +
"\000\002\017\004\000\002\020\004"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\052\000\004\004\005\001\002\000\004\007\012\001" +
"\002\000\004\007\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\006\005\027\007\012\001" +
"\002\000\006\005\ufffd\007\ufffd\001\002\000\004\022\013" +
"\001\002\000\004\006\ufffc\001\002\000\004\006\016\001" +
"\002\000\006\005\ufffb\007\ufffb\001\002\000\004\020\017" +
"\001\002\000\004\010\ufffa\001\002\000\004\010\022\001" +
"\002\000\004\011\024\001\002\000\004\023\023\001\002" +
"\000\004\011\ufff8\001\002\000\004\024\026\001\002\000" +
"\006\005\ufff9\007\ufff9\001\002\000\006\005\ufff7\007\ufff7" +
"\001\002\000\004\012\031\001\002\000\006\005\ufffe\007" +
"\ufffe\001\002\000\004\014\ufff5\001\002\000\004\017\054" +
"\001\002\000\004\014\035\001\002\000\006\014\035\017" +
"\ufff6\001\002\000\004\025\037\001\002\000\006\014\ufff3" +
"\017\ufff3\001\002\000\004\013\ufff2\001\002\000\004\013" +
"\041\001\002\000\004\021\043\001\002\000\006\014\ufff1" +
"\017\ufff1\001\002\000\004\015\ufff0\001\002\000\004\015" +
"\046\001\002\000\004\016\051\001\002\000\004\026\047" +
"\001\002\000\004\016\uffee\001\002\000\006\014\uffef\017" +
"\uffef\001\002\000\004\027\052\001\002\000\006\014\uffed" +
"\017\uffed\001\002\000\006\014\ufff4\017\ufff4\001\002\000" +
"\004\002\001\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\052\000\006\003\005\004\003\001\001\000\006\005" +
"\007\006\010\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\004\006\027\001\001\000\002\001" +
"\001\000\002\001\001\000\004\021\013\001\001\000\004" +
"\007\014\001\001\000\002\001\001\000\002\001\001\000" +
"\004\022\017\001\001\000\004\010\020\001\001\000\004" +
"\011\024\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\006" +
"\012\031\013\032\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\006\014\033\016\035\001\001" +
"\000\004\016\052\001\001\000\002\001\001\000\002\001" +
"\001\000\004\023\037\001\001\000\004\015\041\001\001" +
"\000\002\001\001\000\002\001\001\000\004\024\043\001" +
"\001\000\004\017\044\001\001\000\004\020\047\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
//Each string is of the format
//rmsForce, maximum force, iteration and energy
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results= new HashMap<String,String>();
int mpRMSForceCount=0;
int mpMaximumForceCount=0;
int mpIterationCount=0;
int energyCount=0;
int rmsForceCount=0;
int maximumForceCount=0;
int iterationCount=0;
for(int i=0;i<result.size();i++){
String singleString= result.get(i);
String[] temp = singleString.split(" ");
String secondElement=temp[1];
String thirdElement=temp[2];
if(thirdElement.equals("RMS")){
results.put("G1_Mp_RMS_Force_"+mpRMSForceCount,temp[4]);
mpRMSForceCount++;
}else if (thirdElement.equals("Maximum")){
results.put("G1_MP_Maximum_Force_"+mpMaximumForceCount,temp[4]);
mpMaximumForceCount++;
}else if (temp[3].equals("ITERATION")&&temp[2].equals("MP")){
results.put("G1_MP_Iteration_"+mpIterationCount,temp[3]);
mpIterationCount++;
}else if(thirdElement.equals("ENERGY")){
results.put("G1_Energy_"+energyCount,temp[3]);
energyCount++;
}else if(secondElement.equals("RMS")){
results.put("G1_RMS_Force"+rmsForceCount,temp[3]);
rmsForceCount++;
}else if(secondElement.equals("Maximum")){
results.put("G1_Maximum_Force"+maximumForceCount,temp[3]);
maximumForceCount++;
}else if(thirdElement.equals("ITERATION")){
results.put("G1_Iteration_"+iterationCount,temp[3]);
iterationCount++;
}
}
return results;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private static JTable table;
private static final String tableLabel = "SCF Intermediate Results:";
// private static String cycle = "0";
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
// }
private final G1Parser G1Parser;
/** Constructor */
CUP$parser$actions(G1Parser G1Parser) {
this.G1Parser = G1Parser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // force2 ::= MPRms MPRGRAD
{
Object RESULT = null;
int mprgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int mprgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float mprg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:g1: MP RMS Force "+mprg);
G1Parser.addToResult("CUP:g1: MP RMS Force "+mprg);
CUP$parser$result = new java_cup.runtime.Symbol(14/*force2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // force1 ::= MPMax MPMGRAD
{
Object RESULT = null;
int mpmgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int mpmgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float mpmg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:g1: MP Maximum Force "+mpmg);
G1Parser.addToResult("CUP:g1: MP Maximum Force "+mpmg);
CUP$parser$result = new java_cup.runtime.Symbol(13/*force1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 18: // mpcycle ::= NMP MPITER NT$3 force1 force2
{
Object RESULT = null;
// propagate RESULT from NT$3
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int itleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int itright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
Integer it = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
CUP$parser$result = new java_cup.runtime.Symbol(11/*mpcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 17: // NT$3 ::=
{
Object RESULT = null;
int itleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int itright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer it = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:g1: MP ITERATION "+it);
G1Parser.addToResult("CUP:g1: MP ITERATION "+it);
CUP$parser$result = new java_cup.runtime.Symbol(18/*NT$3*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 16: // mpcycle1 ::= MPEnerg MPENERGY NT$2 mpcycle
{
Object RESULT = null;
// propagate RESULT from NT$2
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int mpenleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int mpenright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Float mpen = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = new java_cup.runtime.Symbol(12/*mpcycle1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // NT$2 ::=
{
Object RESULT = null;
int mpenleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int mpenright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float mpen = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:g1: ENERGY "+mpen);
G1Parser.addToResult("CUP:g1: ENERGY "+mpen);
CUP$parser$result = new java_cup.runtime.Symbol(17/*NT$2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // mppat ::= mpcycle1
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(10/*mppat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // mppat ::= mppat mpcycle1
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:g1: in mppat");
CUP$parser$result = new java_cup.runtime.Symbol(10/*mppat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // mpintro ::= MPStart
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:g1: MPSTart ");
CUP$parser$result = new java_cup.runtime.Symbol(9/*mpintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // mp2 ::= mpintro mppat
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:g1: in mp2 mpintro mppat");
CUP$parser$result = new java_cup.runtime.Symbol(8/*mp2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // grad2 ::= RmsGrad1 RGRAD1
{
Object RESULT = null;
int rgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int rgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float rg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: RMS Force "+rg);
G1Parser.addToResult("CUP:gopt: RMS Force "+rg);
CUP$parser$result = new java_cup.runtime.Symbol(7/*grad2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // grad1 ::= MaxGrad1 MGRAD1
{
Object RESULT = null;
int mgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int mgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float mg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: Maximum Force "+mg);
G1Parser.addToResult("CUP:gopt: Maximum Force "+mg);
CUP$parser$result = new java_cup.runtime.Symbol(6/*grad1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // cycle ::= NSearch1 ITERATION1 NT$1 grad1 grad2
{
Object RESULT = null;
// propagate RESULT from NT$1
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
CUP$parser$result = new java_cup.runtime.Symbol(5/*cycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // NT$1 ::=
{
Object RESULT = null;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: ITERATION "+c);
G1Parser.addToResult("CUP:gopt: ITERATION "+c);
CUP$parser$result = new java_cup.runtime.Symbol(16/*NT$1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // scfcycle ::= Energ1 ENERGY1 NT$0 cycle
{
Object RESULT = null;
// propagate RESULT from NT$0
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Float e = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // NT$0 ::=
{
Object RESULT = null;
int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float e = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: ENERGY "+e);
G1Parser.addToResult("CUP:gopt: ENERGY "+e);
CUP$parser$result = new java_cup.runtime.Symbol(15/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER1
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: found the start of Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE1 mp2 MPDONE
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: end of parse tree ");
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,183 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/whichProgram/WhichProgramLexer.java | package org.apache.airavata.datacat.parsers.gridchem.whichProgram;/* The following code was generated by JFlex 1.4.3 on 11/12/14 6:52 PM */
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 11/12/14 6:52 PM from the specification file
* <tt>whichProgram.flex</tt>
*/
public class WhichProgramLexer implements java_cup.runtime.Scanner{
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int IGNOREALL = 6;
public static final int GETREVISION = 2;
public static final int YYINITIAL = 0;
public static final int GETVERSION = 4;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 3, 3
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 1, 0,
10, 2, 2, 11, 2, 2, 2, 2, 2, 2, 0, 0, 0, 22, 0, 0,
0, 13, 1, 1, 1, 15, 1, 3, 1, 19, 1, 1, 26, 14, 21, 20,
23, 1, 18, 16, 25, 1, 17, 1, 1, 24, 1, 0, 0, 0, 0, 0,
0, 4, 1, 1, 1, 1, 1, 1, 1, 7, 1, 1, 1, 1, 8, 1,
1, 1, 1, 6, 1, 5, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\4\0\3\1\1\2\1\1\13\0\1\3\25\0\1\4"+
"\10\0\1\5\5\0\1\6";
private static int [] zzUnpackAction() {
int [] result = new int[58];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\33\0\66\0\121\0\154\0\207\0\242\0\275"+
"\0\330\0\363\0\u010e\0\u0129\0\u0144\0\u015f\0\u017a\0\u0195"+
"\0\u01b0\0\u01cb\0\u01e6\0\u0201\0\154\0\u021c\0\u0237\0\u0252"+
"\0\u026d\0\u0288\0\u02a3\0\u02be\0\u02d9\0\u02f4\0\u030f\0\u032a"+
"\0\u0345\0\u0360\0\u037b\0\u0396\0\u03b1\0\u03cc\0\u03e7\0\u0402"+
"\0\u041d\0\u0438\0\154\0\u0453\0\u046e\0\u0489\0\u04a4\0\u04bf"+
"\0\u04da\0\u04f5\0\u0510\0\154\0\u052b\0\u0546\0\u0561\0\u057c"+
"\0\u0597\0\154";
private static int [] zzUnpackRowMap() {
int [] result = new int[58];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\3\5\1\6\23\5\1\7\4\5\10\10\1\5\2\10"+
"\1\5\11\10\1\5\4\10\2\5\1\11\7\5\2\11"+
"\52\5\37\0\1\12\10\0\1\13\37\0\1\14\11\0"+
"\10\10\1\0\2\10\1\0\11\10\1\0\4\10\2\0"+
"\1\15\7\0\2\15\24\0\1\16\43\0\1\17\40\0"+
"\1\20\10\0\1\21\7\0\2\21\25\0\1\22\43\0"+
"\1\23\16\0\1\24\31\0\1\25\7\0\2\25\25\0"+
"\1\26\44\0\1\27\34\0\1\30\17\0\1\31\43\0"+
"\1\32\27\0\1\33\21\0\1\34\37\0\1\35\37\0"+
"\1\36\24\0\1\37\43\0\1\40\22\0\1\41\32\0"+
"\1\42\40\0\1\43\33\0\1\44\24\0\1\45\42\0"+
"\1\46\40\0\1\47\15\0\1\50\37\0\1\51\32\0"+
"\1\52\26\0\1\53\41\0\1\54\40\0\1\55\25\0"+
"\1\56\25\0\1\57\40\0\1\60\23\0\1\61\25\0"+
"\1\62\32\0\1\63\47\0\1\64\22\0\1\65\40\0"+
"\1\66\40\0\1\67\27\0\1\70\25\0\1\71\34\0"+
"\1\72\6\0";
private static int [] zzUnpackTrans() {
int [] result = new int[1458];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\4\0\1\11\4\1\13\0\1\11\25\0\1\11\10\0"+
"\1\11\5\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[58];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
public static String format;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public WhichProgramLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public WhichProgramLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public int yylex() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 2:
{ if (Settings.DEBUG) System.out.println(yytext());
yybegin(IGNOREALL);
}
case 7: break;
case 3:
{ if (Settings.DEBUG) System.out.println(yytext());
yybegin(IGNOREALL);
}
case 8: break;
case 4:
{ if (Settings.DEBUG) System.out.println(yytext());
WhichProgramLexer.format = "Gauss03";
}
case 9: break;
case 6:
{ System.out.println(yytext());
WhichProgramLexer.format = "Molpro";
yybegin(IGNOREALL);
}
case 10: break;
case 5:
{ if (Settings.DEBUG) System.out.println(yytext());
WhichProgramLexer.format = "GAMESS";
yybegin(GETVERSION);
}
case 11: break;
case 1:
{
}
case 12: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
return YYEOF;
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java WhichProgram <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
WhichProgramLexer scanner = null;
try {
scanner = new WhichProgramLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.yylex();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
@Override
public Symbol next_token() throws Exception {
return null;
}
}
| 9,184 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/whichProgram/WhichProgramSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.whichProgram;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Wed Nov 12 18:52:46 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class WhichProgramSym {
/* terminals */
public static final int MGRAD = 10;
public static final int RmsGrad = 7;
public static final int Energ = 5;
public static final int MaxGrad = 6;
public static final int ENERGY = 9;
public static final int EOF = 0;
public static final int ITERATION = 8;
public static final int NSearch = 4;
public static final int RGRAD = 11;
public static final int error = 1;
public static final int SCFDONE = 3;
public static final int FOUNDITER = 2;
}
| 9,185 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/whichProgram/WhichProgramParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.whichProgram;
import java_cup.runtime.lr_parser;
import javax.swing.*;
public class WhichProgramParser extends java_cup.runtime.lr_parser {
/** Default constructor. */
public WhichProgramParser() {super();}
/** Constructor which sets the default scanner. */
public WhichProgramParser(java_cup.runtime.Scanner s) {super(s);}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\013\000\002\003\005\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\012\002" +
"\000\002\006\006\000\002\013\002\000\002\007\007\000" +
"\002\010\004\000\002\011\004"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\026\000\004\004\005\001\002\000\004\007\011\001" +
"\002\000\004\007\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\006\005\027\007\011\001" +
"\002\000\004\013\013\001\002\000\006\005\ufffd\007\ufffd" +
"\001\002\000\004\006\ufffc\001\002\000\004\006\015\001" +
"\002\000\004\012\017\001\002\000\006\005\ufffb\007\ufffb" +
"\001\002\000\004\010\ufffa\001\002\000\004\010\021\001" +
"\002\000\004\014\026\001\002\000\004\011\024\001\002" +
"\000\006\005\ufff9\007\ufff9\001\002\000\004\015\025\001" +
"\002\000\006\005\ufff7\007\ufff7\001\002\000\004\011\ufff8" +
"\001\002\000\004\002\001\001\002\000\006\005\ufffe\007" +
"\ufffe\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\026\000\006\003\005\004\003\001\001\000\006\005" +
"\007\006\011\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\004\006\027\001\001\000\002\001" +
"\001\000\002\001\001\000\004\012\013\001\001\000\004" +
"\007\015\001\001\000\002\001\001\000\002\001\001\000" +
"\004\013\017\001\001\000\004\010\021\001\001\000\002" +
"\001\001\000\004\011\022\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private static JTable table;
private static final String tableLabel = "SCF Intermediate Results:";
// private static String cycle = "0";
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
// }
private final WhichProgramParser parser;
/** Constructor */
CUP$parser$actions(WhichProgramParser WhichProgramParser) {
this.parser = WhichProgramParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // grad2 ::= RmsGrad RGRAD
{
Object RESULT = null;
int rgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int rgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float rg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: RMS Force "+rg);
CUP$parser$result = new java_cup.runtime.Symbol(7/*grad2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // grad1 ::= MaxGrad MGRAD
{
Object RESULT = null;
int mgleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int mgright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float mg = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: Maximum Force "+mg);
CUP$parser$result = new java_cup.runtime.Symbol(6/*grad1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // cycle ::= NSearch ITERATION NT$1 grad1 grad2
{
Object RESULT = null;
// propagate RESULT from NT$1
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
CUP$parser$result = new java_cup.runtime.Symbol(5/*cycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // NT$1 ::=
{
Object RESULT = null;
int cleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int cright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer c = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: ITERATION "+c);
CUP$parser$result = new java_cup.runtime.Symbol(9/*NT$1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // scfcycle ::= Energ ENERGY NT$0 cycle
{
Object RESULT = null;
// propagate RESULT from NT$0
if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null )
RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
Float e = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // NT$0 ::=
{
Object RESULT = null;
int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float e = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:gopt: ENERGY "+e);
CUP$parser$result = new java_cup.runtime.Symbol(8/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: found the start of Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gopt: end of parse tree ");
table = new JTable();
// table = parseSCF.getTable();
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,186 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gaussian/GaussianLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gaussian;/* The following code was generated by JFlex 1.4.3 on 9/10/14 9:00 AM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/10/14 9:00 AM from the specification file
* <tt>gaussian.flex</tt>
*/
public class GaussianLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int IGNOREALL = 6;
public static final int ITER1 = 4;
public static final int YYINITIAL = 0;
public static final int ITER = 2;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 3, 3
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
0, 19, 9, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 13, 18, 12, 0, 0, 0, 0, 7, 0, 0,
8, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 21, 0, 23, 15, 22, 14, 0, 0, 0, 0, 24, 0, 3,
4, 0, 16, 20, 5, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\4\0\22\1\4\0\1\2\2\0\1\3\4\0\1\4"+
"\6\0\1\5\1\6\1\7\1\10\1\11\1\0\1\12"+
"\1\13\1\14\1\15\3\0\1\16\1\0\1\17\1\20"+
"\42\0\1\21\1\22";
private static int [] zzUnpackAction() {
int [] result = new int[94];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\31\0\62\0\113\0\144\0\175\0\226\0\257"+
"\0\310\0\341\0\372\0\u0113\0\u012c\0\u0145\0\u015e\0\u0177"+
"\0\u0190\0\u01a9\0\u01c2\0\u01db\0\u01f4\0\u020d\0\u0226\0\u023f"+
"\0\u0258\0\u0271\0\144\0\u028a\0\u02a3\0\144\0\u02bc\0\u02d5"+
"\0\u02ee\0\u0307\0\144\0\u01a9\0\u0320\0\u0339\0\u0352\0\u036b"+
"\0\u0384\0\144\0\144\0\144\0\144\0\144\0\u039d\0\144"+
"\0\144\0\144\0\144\0\u03b6\0\u03cf\0\u03e8\0\144\0\u0401"+
"\0\144\0\144\0\u041a\0\u0433\0\u044c\0\u0465\0\u047e\0\u0497"+
"\0\u04b0\0\u04c9\0\u04e2\0\u04fb\0\u0514\0\u052d\0\u0546\0\u055f"+
"\0\u0578\0\u0591\0\u05aa\0\u05c3\0\u05dc\0\u05f5\0\u060e\0\u0627"+
"\0\u0640\0\u0659\0\u0672\0\u068b\0\u06a4\0\u06bd\0\u06d6\0\u06ef"+
"\0\u0708\0\u0721\0\u073a\0\u0753\0\144\0\144";
private static int [] zzUnpackRowMap() {
int [] result = new int[94];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\2\5\1\6\31\5\1\7\3\5\1\10\3\5\1\11"+
"\2\5\1\12\1\5\1\13\1\14\1\15\10\5\1\16"+
"\1\17\3\5\1\20\3\5\1\21\2\5\1\22\1\5"+
"\1\23\1\24\2\5\1\25\1\5\1\26\33\5\33\0"+
"\1\27\32\0\1\30\34\0\1\31\34\0\1\32\33\0"+
"\1\33\27\0\1\34\30\0\1\35\35\0\1\36\7\0"+
"\1\37\32\0\1\40\34\0\1\41\34\0\1\42\33\0"+
"\1\43\27\0\1\44\30\0\1\45\37\0\1\46\32\0"+
"\1\47\3\0\1\50\33\0\1\51\34\0\1\52\1\53"+
"\33\0\1\54\32\0\1\55\30\0\1\56\13\0\1\57"+
"\33\0\1\60\34\0\1\61\34\0\1\62\32\0\1\63"+
"\30\0\1\64\14\0\1\65\27\0\1\66\34\0\1\67"+
"\24\0\1\70\27\0\1\71\57\0\1\72\2\0\1\73"+
"\30\0\1\74\30\0\1\75\30\0\1\76\30\0\1\77"+
"\30\0\1\100\30\0\1\101\30\0\1\102\30\0\1\103"+
"\30\0\1\104\30\0\1\105\30\0\1\106\30\0\1\107"+
"\30\0\1\110\30\0\1\111\30\0\1\112\30\0\1\113"+
"\30\0\1\114\30\0\1\115\30\0\1\116\30\0\1\117"+
"\30\0\1\120\30\0\1\121\30\0\1\122\30\0\1\123"+
"\30\0\1\124\30\0\1\125\30\0\1\126\30\0\1\127"+
"\30\0\1\130\30\0\1\131\30\0\1\132\30\0\1\133"+
"\30\0\1\134\30\0\1\135\30\0\1\136\26\0";
private static int [] zzUnpackTrans() {
int [] result = new int[1900];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\4\0\1\11\21\1\4\0\1\11\2\0\1\11\4\0"+
"\1\11\6\0\5\11\1\0\4\11\3\0\1\11\1\0"+
"\2\11\42\0\2\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[94];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public GaussianLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public GaussianLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 17:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found Gaussian 98");
yybegin(ITER);
return new Symbol(GaussianSym.FOUNDITER);
}
case 19: break;
case 12:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found RHF");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 20: break;
case 8:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found rhf");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 21: break;
case 2:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found hf");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 22: break;
case 16:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found geom");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 23: break;
case 10:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found opt ");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 24: break;
case 7:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found RHF");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 25: break;
case 3:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found G1");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 26: break;
case 18:
{ yybegin(IGNOREALL);
return new Symbol(GaussianSym.SCFDONE);
}
case 27: break;
case 13:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found uhf");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 28: break;
case 9:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found uhf");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 29: break;
case 11:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found MP2");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 30: break;
case 4:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found rhf");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 31: break;
case 15:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found scf=");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype2"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(IGNOREALL);
return new Symbol(GaussianSym.RUNTYP1);
}
case 32: break;
case 6:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found MP4");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 33: break;
case 5:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found MP2");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 34: break;
case 14:
{ if (Settings.DEBUG) System.out.println("GaussianFlex: Found opt ");
if (Settings.DEBUG) System.out.println(yytext());
try{
PrintStream temp = new PrintStream(new FileOutputStream("runtype1"));
temp.print(yytext());
System.out.println(yytext());}
catch (IOException ie){ System.out.println("Error in Gaussian Lexer");}
yybegin(ITER1);
return new Symbol(GaussianSym.RUNTYP);
}
case 35: break;
case 1:
{
}
case 36: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(GaussianSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = GaussianSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java GaussianLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
GaussianLexer scanner = null;
try {
scanner = new GaussianLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,187 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gaussian/GaussianParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gaussian;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import java.io.FileReader;
import java.util.HashMap;
public class GaussianParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public GaussianParser() {super();}
/** Constructor which sets the default scanner. */
public GaussianParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public GaussianParser(final FileReader fileReader) {
super(new GaussianLexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\003\000\002\003\003\000\002\002\004\000\002\004" +
"\005"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\007\000\004\004\005\001\002\000\004\002\001\001" +
"\002\000\004\006\010\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\004\007\011\001\002\000" +
"\004\002\uffff\001\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\007\000\006\003\005\004\003\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
return null;
}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private final GaussianParser GaussianParser;
/** Constructor */
CUP$parser$actions(GaussianParser GaussianParser) {
this.GaussianParser = GaussianParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER RUNTYP RUNTYP1
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gaussian: found FOUNDITER ");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:gaussian: end of parse tree ");
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,188 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/gaussian/GaussianSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.gaussian;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Wed Sep 10 09:00:14 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class GaussianSym {
/* terminals */
public static final int RUNTYP = 4;
public static final int SCFDONE = 3;
public static final int error = 1;
public static final int FOUNDITER = 2;
public static final int RUNTYP1 = 5;
public static final int EOF = 0;
}
| 9,189 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/util/GridChemProperties.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.util;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.io.*;
public class GridChemProperties {
public static final String GRIDCHEM_PARSERS_PROPERTIES = "../conf/gridchem.properties";
public static final String DEFAULT_GRIDCHEM_PARSERS_PROPERTIES = "gridchem.properties";
private static GridChemProperties instance;
private final Logger logger = LogManager.getLogger(GridChemProperties.class);
private java.util.Properties properties = null;
private GridChemProperties() {
try {
InputStream fileInput;
if (new File(GRIDCHEM_PARSERS_PROPERTIES).exists()) {
fileInput = new FileInputStream(GRIDCHEM_PARSERS_PROPERTIES);
} else {
fileInput = ClassLoader.getSystemResource(DEFAULT_GRIDCHEM_PARSERS_PROPERTIES).openStream();
}
java.util.Properties properties = new java.util.Properties();
properties.load(fileInput);
fileInput.close();
this.properties = properties;
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public static GridChemProperties getInstance() {
if (instance == null) {
instance = new GridChemProperties();
}
return instance;
}
public String[] getParserSequence() {
String parsers = getProperty(Constants.PARSER_SEQUENCE, "");
String[] parserArray = parsers.split(",");
return parserArray;
}
public String getProperty(String key, String defaultVal) {
String val = this.properties.getProperty(key);
if (val.isEmpty() || val == "") {
return defaultVal;
} else {
return val;
}
}
}
| 9,190 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/util/Fields.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.util;
public class Fields {
public static final String INCHI = "inchi";
public static final String INCHI_KEY = "inchi_key";
}
| 9,191 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/util/AccessLevels.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.util;
public class AccessLevels {
public static final String PRIVATE = "private";
public static final String GROUP = "group";
public static final String COMMUNITY = "community";
public static final String GLOBAL = "global";
}
| 9,192 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/util/Constants.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.util;
public class Constants {
public static final String PARSER_SEQUENCE = "PARSER_SEQUENCE";
public static final String ARCHIVING_NODE = "ARCHIVING_NODE";
public static final String APPLICATION_NAME = "APPLICATION_NAME";
public static final String USERNAME = "USERNAME";
public static final String AGENT_USERNAME = "AGENT_USERNAME";
public static final String AGENT_PASSWORD = "AGENT_PASSWORD";
public static final String TMP_DIR = "TMP_DIR";
public static final String SAMPLE_OUTPUT = "SAMPLE_OUTPUT";
}
| 9,193 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/mp2to5a/MP2to5aParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.mp2to5a;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
public class MP2to5aParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public MP2to5aParser() {super();}
/** Constructor which sets the default scanner. */
public MP2to5aParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public MP2to5aParser(final FileReader fileReader) {
super(new MP2to5aLexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\005\000\002\003\004\000\002\002\004\000\002\003" +
"\003\000\002\004\003\000\002\004\003"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\007\000\006\023\004\024\006\001\002\000\010\002" +
"\ufffe\023\ufffe\024\ufffe\001\002\000\010\002\uffff\023\uffff" +
"\024\uffff\001\002\000\010\002\ufffd\023\ufffd\024\ufffd\001" +
"\002\000\010\002\011\023\004\024\006\001\002\000\010" +
"\002\001\023\001\024\001\001\002\000\004\002\000\001" +
"\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\007\000\006\003\006\004\004\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\004\004\007" +
"\001\001\000\002\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
//Each string is of the format
//mp2SpecificOption
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results=new HashMap<String,String>();
int count=0;
for(int i=0;i<result.size();i++){
String singleString= result.get(i);
String[] temp= singleString.split(" ");
if(temp.length>1){
String keyString=temp[0];
String dataString=temp[1];
if(keyString.equalsIgnoreCase("SpecificOption")){
results.put("MP2to5aParser_MP2_Specific_Option_"+count,dataString);
count++;
}
}
}
return results;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
/** User initialization code. */
public void user_init() throws java.lang.Exception
{
if(Settings.DEBUG) System.out.println("CUP:mp2to5a: entry");
}
///public static boolean DEBUG = false;
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
private final MP2to5aParser MP2to5aParser;
/** Constructor */
CUP$parser$actions(MP2to5aParser MP2to5aParser) {
this.MP2to5aParser = MP2to5aParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // element ::= LIM
{
Object RESULT = null;
int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
String s = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
if(Settings.DEBUG) System.out.println("CUP:mp2to5a: MP2-Specific Option: "+s);
MP2to5aParser.addToResult("SpecificOption "+s);
// ParseMP2to5.put("Limitations to MP5: ", s);
CUP$parser$result = new java_cup.runtime.Symbol(2/*element*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // element ::= VAR
{
Object RESULT = null;
int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
String s = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
if(Settings.DEBUG) System.out.println("CUP:mp2to5a: MP2-Specific Option: "+s);
MP2to5aParser.addToResult("SpecificOption "+s);
//ParseMP2to5.put("Variations of MP4: ", s);
CUP$parser$result = new java_cup.runtime.Symbol(2/*element*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // startpt ::= element
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= startpt element
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,194 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/mp2to5a/MP2to5aSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.mp2to5a;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Sun Sep 14 11:25:52 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class MP2to5aSym {
/* terminals */
public static final int E4_SDTQ = 8;
public static final int MP2OPT = 16;
public static final int LIM = 18;
public static final int UMP4_SDQ = 11;
public static final int UMP4_SDTQ = 12;
public static final int E4_DQ = 6;
public static final int FCOPT = 13;
public static final int UMP4_DQ = 10;
public static final int E4_SDQ = 7;
public static final int E3 = 5;
public static final int E2 = 2;
public static final int FLOAT = 19;
public static final int EOF = 0;
public static final int error = 1;
public static final int MP4_T = 4;
public static final int FCOPT2 = 14;
public static final int ALGOPT = 15;
public static final int VAR = 17;
public static final int EUMP3 = 9;
public static final int EUMP2 = 3;
}
| 9,195 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/mp2to5a/MP2to5aLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.mp2to5a;/* The following code was generated by JFlex 1.4.3 on 9/14/14 11:25 AM */
/* MP2 to MP5 Keywords
Last Update: 12/31/2000
http://www.gaussian.com/00000456.htm
*/
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/14/14 11:25 AM from the specification file
* <tt>mp2to5a.flex</tt>
*/
public class MP2to5aLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int IGNOREALL = 4;
public static final int FLOATVAL = 2;
public static final int YYINITIAL = 0;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 6, 7, 0, 2, 0, 2, 3, 0,
1, 1, 1, 1, 10, 15, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 11, 4, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0,
9, 12, 0, 13, 14, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\3\0\5\1\3\0\1\2\1\0\1\3\3\0\1\4"+
"\1\2\5\0\1\5\2\0\1\6\1\0\1\7";
private static int [] zzUnpackAction() {
int [] result = new int[30];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\21\0\42\0\63\0\104\0\125\0\146\0\167"+
"\0\210\0\231\0\146\0\252\0\273\0\63\0\314\0\335"+
"\0\356\0\63\0\377\0\377\0\u0110\0\u0121\0\u0132\0\u0143"+
"\0\63\0\u0154\0\u0165\0\63\0\u0176\0\63";
private static int [] zzUnpackRowMap() {
int [] result = new int[30];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\10\4\1\5\7\4\1\6\1\4\1\7\1\10\2\4"+
"\1\10\4\4\1\7\4\4\1\7\22\4\32\0\1\11"+
"\17\0\1\12\11\0\1\13\1\0\1\14\6\0\1\13"+
"\4\0\1\13\2\0\1\13\10\0\1\13\4\0\1\13"+
"\13\0\1\15\4\0\1\16\12\0\1\17\10\0\1\14"+
"\2\0\2\20\4\0\1\14\1\20\3\0\1\14\7\0"+
"\1\21\31\0\1\22\2\0\1\23\1\24\2\0\1\24"+
"\4\0\1\23\4\0\1\23\14\0\1\25\1\0\1\26"+
"\4\0\1\23\10\0\1\23\4\0\1\23\15\0\1\27"+
"\17\0\1\30\14\0\1\31\25\0\1\32\1\0\1\33"+
"\11\0\1\34\25\0\1\35\13\0\1\36\11\0";
private static int [] zzUnpackTrans() {
int [] result = new int[391];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\3\0\1\11\4\1\3\0\1\1\1\0\1\11\3\0"+
"\1\11\1\1\5\0\1\11\2\0\1\11\1\0\1\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[30];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public MP2to5aLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public MP2to5aLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 4:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
return new Symbol(MP2to5aSym.LIM, yytext());
}
case 8: break;
case 7:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
return new Symbol(MP2to5aSym.VAR, yytext());
}
case 9: break;
case 2:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
yybegin(YYINITIAL);
return new Symbol(MP2to5aSym.FLOAT, yytext());
}
case 10: break;
case 3:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
return new Symbol(MP2to5aSym.LIM, yytext());
}
case 11: break;
case 5:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
return new Symbol(MP2to5aSym.VAR, yytext());
}
case 12: break;
case 6:
{ if(Settings.DEBUG) System.out.println("JFlex:mp2to5: "+yytext());
return new Symbol(MP2to5aSym.VAR, yytext());
}
case 13: break;
case 1:
{
}
case 14: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(MP2to5aSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = MP2to5aSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java MP2to5aLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
MP2to5aLexer scanner = null;
try {
scanner = new MP2to5aLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,196 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/input/InputSym.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.input;
//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Thu Sep 11 18:37:51 IST 2014
//----------------------------------------------------
/** CUP generated class containing symbol constants. */
public class InputSym {
/* terminals */
public static final int ENERGY = 11;
public static final int EOF = 0;
public static final int ITERATION = 10;
public static final int INPUT7 = 14;
public static final int error = 1;
public static final int INPUT6 = 13;
public static final int INPUT5 = 12;
public static final int INPUT4 = 9;
public static final int SCFDONE = 4;
public static final int INPUT3 = 8;
public static final int FOUNDITER = 3;
public static final int INPUT2 = 7;
public static final int DASH2 = 6;
public static final int INPUT1 = 2;
public static final int DASH1 = 5;
}
| 9,197 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/input/InputLexer.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.input;/* The following code was generated by JFlex 1.4.3 on 9/11/14 6:37 PM */
import java_cup.runtime.Symbol;
import org.apache.airavata.datacat.parsers.gridchem.Settings;
/**
* This class is a scanner generated by
* <a href="http://www.jflex.de/">JFlex</a> 1.4.3
* on 9/11/14 6:37 PM from the specification file
* <tt>input.flex</tt>
*/
public class InputLexer implements java_cup.runtime.Scanner {
/** This character denotes the end of file */
public static final int YYEOF = -1;
/** initial size of the lookahead buffer */
private static final int ZZ_BUFFERSIZE = 16384;
/** lexical states */
public static final int INPUTF = 30;
public static final int ITER2 = 4;
public static final int INPUTE = 28;
public static final int INPUTD = 26;
public static final int INPUTC = 24;
public static final int INPUTB = 22;
public static final int INPUTA = 20;
public static final int INTVALUE = 8;
public static final int INPUT = 18;
public static final int IGNOREALL = 16;
public static final int ITER = 2;
public static final int YYINITIAL = 0;
public static final int FLOAT2 = 14;
public static final int FLOAT1 = 12;
public static final int FLOATVALUE = 10;
public static final int ITER3 = 6;
/**
* ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l
* ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l
* at the beginning of a line
* l is of the form l = 2*k, k a non negative integer
*/
private static final int ZZ_LEXSTATE[] = {
0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9
};
/**
* Translates characters to character classes
*/
private static final char [] ZZ_CMAP = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 31, 3, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 27, 25, 4, 0, 24, 29, 0, 0, 30, 0, 5, 28,
0, 0, 0, 0, 23, 0, 0, 0, 20, 21, 22, 0, 0, 0, 0, 26,
0, 0, 8, 0, 0, 9, 13, 0, 19, 17, 0, 0, 0, 7, 18, 12,
16, 0, 10, 14, 15, 6, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
/**
* Translates DFA states to action switch labels.
*/
private static final int [] ZZ_ACTION = zzUnpackAction();
private static final String ZZ_ACTION_PACKED_0 =
"\12\0\4\1\1\2\2\1\1\3\1\1\1\4\10\1"+
"\17\0\1\5\1\6\1\7\72\0\1\10\47\0\1\11"+
"\5\0\1\12\124\0\1\13\1\14";
private static int [] zzUnpackAction() {
int [] result = new int[237];
int offset = 0;
offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAction(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/**
* Translates a state to a row index in the transition table
*/
private static final int [] ZZ_ROWMAP = zzUnpackRowMap();
private static final String ZZ_ROWMAP_PACKED_0 =
"\0\0\0\40\0\100\0\140\0\200\0\240\0\300\0\340"+
"\0\u0100\0\u0120\0\u0140\0\u0160\0\u0180\0\u01a0\0\u01c0\0\u01c0"+
"\0\u01e0\0\u0200\0\u0200\0\u0220\0\u0220\0\u0240\0\u0260\0\u0280"+
"\0\u02a0\0\u02c0\0\u02e0\0\u0300\0\u0320\0\u0340\0\u0360\0\u0380"+
"\0\u0240\0\u03a0\0\u0280\0\u03c0\0\u02c0\0\u03e0\0\u0400\0\u0420"+
"\0\u0440\0\u0460\0\u0480\0\u03a0\0\u03c0\0\u03e0\0\u04a0\0\u04c0"+
"\0\u04e0\0\u0500\0\u0520\0\u0540\0\u0560\0\u0580\0\u05a0\0\u05c0"+
"\0\u05e0\0\u0600\0\u0620\0\u0640\0\u0660\0\u0680\0\u06a0\0\u06c0"+
"\0\u06e0\0\u0700\0\u0720\0\u0740\0\u0760\0\u0780\0\u07a0\0\u07c0"+
"\0\u07e0\0\u0800\0\u0820\0\u0840\0\u0860\0\u0880\0\u08a0\0\u08c0"+
"\0\u08e0\0\u0900\0\u0920\0\u0940\0\u0960\0\u0980\0\u09a0\0\u09c0"+
"\0\u09e0\0\u0a00\0\u0a20\0\u0a40\0\u0a60\0\u0a80\0\u0aa0\0\u0ac0"+
"\0\u0ae0\0\u0b00\0\u0b20\0\u0b40\0\u0b60\0\u0b80\0\u0ba0\0\u0bc0"+
"\0\u0140\0\u0be0\0\u0c00\0\u0c20\0\u0c40\0\u0c60\0\u0c80\0\u0ca0"+
"\0\u0cc0\0\u0ce0\0\u0d00\0\u0d20\0\u0d40\0\u0d60\0\u0d80\0\u0da0"+
"\0\u0dc0\0\u0de0\0\u0e00\0\u0e20\0\u0e40\0\u0e60\0\u0e80\0\u0ea0"+
"\0\u0ec0\0\u0ee0\0\u0f00\0\u0f20\0\u0f40\0\u0f60\0\u0f80\0\u0fa0"+
"\0\u0fc0\0\u0fe0\0\u1000\0\u1020\0\u1040\0\u1060\0\u1080\0\u10a0"+
"\0\u0140\0\u10c0\0\u10e0\0\u1100\0\u1120\0\u1140\0\u0140\0\u1160"+
"\0\u1180\0\u11a0\0\u11c0\0\u11e0\0\u1200\0\u1220\0\u1240\0\u1260"+
"\0\u1280\0\u12a0\0\u12c0\0\u12e0\0\u1300\0\u1320\0\u1340\0\u1360"+
"\0\u1380\0\u13a0\0\u13c0\0\u13e0\0\u1400\0\u1420\0\u1440\0\u1460"+
"\0\u1480\0\u14a0\0\u14c0\0\u14e0\0\u1500\0\u1520\0\u1540\0\u1560"+
"\0\u1580\0\u15a0\0\u15c0\0\u15e0\0\u1600\0\u1620\0\u1640\0\u1660"+
"\0\u1680\0\u16a0\0\u16c0\0\u16e0\0\u1700\0\u1720\0\u1740\0\u1760"+
"\0\u1780\0\u17a0\0\u17c0\0\u17e0\0\u1800\0\u1820\0\u1840\0\u1860"+
"\0\u1880\0\u18a0\0\u18c0\0\u18e0\0\u1900\0\u1920\0\u1940\0\u1960"+
"\0\u1980\0\u19a0\0\u19c0\0\u19e0\0\u1a00\0\u1a20\0\u1a40\0\u1a60"+
"\0\u1a80\0\u1aa0\0\u1ac0\0\u1ae0\0\u1b00\0\u1b20\0\u1b40\0\u1b60"+
"\0\u1b80\0\u1ba0\0\u1bc0\0\u0140\0\u0140";
private static int [] zzUnpackRowMap() {
int [] result = new int[237];
int offset = 0;
offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
return result;
}
private static int zzUnpackRowMap(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int high = packed.charAt(i++) << 16;
result[j++] = high | packed.charAt(i++);
}
return j;
}
/**
* The transition table of the DFA
*/
private static final int [] ZZ_TRANS = zzUnpackTrans();
private static final String ZZ_TRANS_PACKED_0 =
"\5\13\1\14\56\13\1\15\2\13\1\16\51\13\1\17"+
"\1\20\34\13\1\21\1\13\1\22\1\23\34\13\1\23"+
"\1\13\1\24\1\25\34\13\1\25\1\13\1\26\1\27"+
"\34\13\1\27\1\13\1\30\1\31\34\13\1\31\1\13"+
"\1\32\1\33\34\13\1\33\37\13\1\34\46\0\1\35"+
"\44\0\1\36\54\0\1\37\10\0\1\17\37\0\1\17"+
"\35\0\1\40\1\0\1\22\37\0\1\24\37\0\1\41"+
"\1\0\1\42\35\0\1\41\37\0\1\43\1\0\1\44"+
"\35\0\1\43\37\0\1\45\1\0\1\46\35\0\1\45"+
"\75\0\1\47\7\0\1\50\43\0\1\51\55\0\1\52"+
"\45\0\1\53\1\0\1\54\37\0\1\55\37\0\1\56"+
"\75\0\1\57\10\0\1\60\42\0\1\61\56\0\1\62"+
"\44\0\1\63\37\0\1\64\11\0\1\65\41\0\1\66"+
"\55\0\1\67\45\0\1\70\37\0\1\71\12\0\1\72"+
"\40\0\1\73\31\0\1\74\71\0\1\75\37\0\1\76"+
"\13\0\1\77\37\0\1\100\57\0\1\101\43\0\1\102"+
"\37\0\1\103\14\0\1\104\36\0\1\105\56\0\1\106"+
"\44\0\1\107\37\0\1\110\15\0\1\111\35\0\1\112"+
"\60\0\1\113\42\0\1\114\37\0\1\115\13\0\1\116"+
"\37\0\1\117\30\0\1\120\72\0\1\121\37\0\1\122"+
"\16\0\1\123\34\0\1\124\56\0\1\125\44\0\1\126"+
"\37\0\1\127\17\0\1\130\33\0\1\131\30\0\1\132"+
"\72\0\1\133\37\0\1\134\11\0\1\135\53\0\1\136"+
"\47\0\1\137\41\0\1\140\37\0\1\141\20\0\1\142"+
"\32\0\1\143\62\0\1\144\40\0\1\145\37\0\1\146"+
"\16\0\1\147\34\0\1\150\55\0\1\151\45\0\1\152"+
"\37\0\1\153\13\0\1\154\37\0\1\155\63\0\1\156"+
"\37\0\1\157\21\0\1\160\31\0\1\161\63\0\1\162"+
"\37\0\1\163\22\0\1\164\30\0\1\165\63\0\1\166"+
"\37\0\1\167\13\0\1\170\37\0\1\171\63\0\1\172"+
"\37\0\1\173\17\0\1\174\33\0\1\175\63\0\1\176"+
"\37\0\1\177\23\0\1\200\27\0\1\201\63\0\1\202"+
"\37\0\1\203\21\0\1\204\31\0\1\205\63\0\1\206"+
"\37\0\1\207\16\0\1\210\34\0\1\211\63\0\1\212"+
"\37\0\1\213\13\0\1\214\37\0\1\215\63\0\1\216"+
"\37\0\1\217\12\0\1\220\53\0\1\221\50\0\1\222"+
"\37\0\1\223\6\0\1\224\70\0\1\225\37\0\1\226"+
"\22\0\1\227\54\0\1\230\37\0\1\231\37\0\1\232"+
"\37\0\1\233\37\0\1\234\37\0\1\235\37\0\1\236"+
"\37\0\1\237\37\0\1\240\37\0\1\241\37\0\1\242"+
"\37\0\1\243\37\0\1\244\37\0\1\245\37\0\1\246"+
"\37\0\1\247\37\0\1\250\37\0\1\251\37\0\1\252"+
"\37\0\1\253\37\0\1\254\37\0\1\255\37\0\1\256"+
"\37\0\1\257\37\0\1\260\37\0\1\261\37\0\1\262"+
"\37\0\1\263\37\0\1\264\37\0\1\265\37\0\1\266"+
"\37\0\1\267\37\0\1\270\37\0\1\271\37\0\1\272"+
"\37\0\1\273\37\0\1\274\37\0\1\275\37\0\1\276"+
"\37\0\1\277\37\0\1\300\37\0\1\301\37\0\1\302"+
"\37\0\1\303\37\0\1\304\37\0\1\305\37\0\1\306"+
"\37\0\1\307\37\0\1\310\37\0\1\311\37\0\1\312"+
"\37\0\1\313\37\0\1\314\37\0\1\315\37\0\1\316"+
"\37\0\1\317\37\0\1\320\37\0\1\321\37\0\1\322"+
"\37\0\1\323\37\0\1\324\37\0\1\325\37\0\1\326"+
"\37\0\1\327\37\0\1\330\37\0\1\331\37\0\1\332"+
"\37\0\1\333\37\0\1\334\37\0\1\335\37\0\1\336"+
"\37\0\1\337\37\0\1\340\37\0\1\341\37\0\1\342"+
"\37\0\1\343\37\0\1\344\37\0\1\345\37\0\1\346"+
"\37\0\1\347\37\0\1\350\37\0\1\351\37\0\1\352"+
"\37\0\1\353\37\0\1\354\37\0\1\355";
private static int [] zzUnpackTrans() {
int [] result = new int[7136];
int offset = 0;
offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result);
return result;
}
private static int zzUnpackTrans(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
value--;
do result[j++] = value; while (--count > 0);
}
return j;
}
/* error codes */
private static final int ZZ_UNKNOWN_ERROR = 0;
private static final int ZZ_NO_MATCH = 1;
private static final int ZZ_PUSHBACK_2BIG = 2;
/* error messages for the codes above */
private static final String ZZ_ERROR_MSG[] = {
"Unkown internal scanner error",
"Error: could not match input",
"Error: pushback value was too large"
};
/**
* ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code>
*/
private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute();
private static final String ZZ_ATTRIBUTE_PACKED_0 =
"\12\0\1\11\21\1\17\0\3\1\72\0\1\11\47\0"+
"\1\11\5\0\1\11\124\0\2\11";
private static int [] zzUnpackAttribute() {
int [] result = new int[237];
int offset = 0;
offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
return result;
}
private static int zzUnpackAttribute(String packed, int offset, int [] result) {
int i = 0; /* index in packed string */
int j = offset; /* index in unpacked array */
int l = packed.length();
while (i < l) {
int count = packed.charAt(i++);
int value = packed.charAt(i++);
do result[j++] = value; while (--count > 0);
}
return j;
}
/** the input device */
private java.io.Reader zzReader;
/** the current state of the DFA */
private int zzState;
/** the current lexical state */
private int zzLexicalState = YYINITIAL;
/** this buffer contains the current text to be matched and is
the source of the yytext() string */
private char zzBuffer[] = new char[ZZ_BUFFERSIZE];
/** the textposition at the last accepting state */
private int zzMarkedPos;
/** the current text position in the buffer */
private int zzCurrentPos;
/** startRead marks the beginning of the yytext() string in the buffer */
private int zzStartRead;
/** endRead marks the last character in the buffer, that has been read
from input */
private int zzEndRead;
/** number of newlines encountered up to the start of the matched text */
private int yyline;
/** the number of characters up to the start of the matched text */
private int yychar;
/**
* the number of characters from the last newline up to the start of the
* matched text
*/
private int yycolumn;
/**
* zzAtBOL == true <=> the scanner is currently at the beginning of a line
*/
private boolean zzAtBOL = true;
/** zzAtEOF == true <=> the scanner is at the EOF */
private boolean zzAtEOF;
/** denotes if the user-EOF-code has already been executed */
private boolean zzEOFDone;
/* user code: */
public static boolean DEBUG = false;
/**
* Creates a new scanner
* There is also a java.io.InputStream version of this constructor.
*
* @param in the java.io.Reader to read input from.
*/
public InputLexer(java.io.Reader in) {
this.zzReader = in;
}
/**
* Creates a new scanner.
* There is also java.io.Reader version of this constructor.
*
* @param in the java.io.Inputstream to read input from.
*/
public InputLexer(java.io.InputStream in) {
this(new java.io.InputStreamReader(in));
}
/**
* Refills the input buffer.
*
* @return <code>false</code>, iff there was new input.
*
* @exception java.io.IOException if any I/O-Error occurs
*/
private boolean zzRefill() throws java.io.IOException {
/* first: make room (if you can) */
if (zzStartRead > 0) {
System.arraycopy(zzBuffer, zzStartRead,
zzBuffer, 0,
zzEndRead-zzStartRead);
/* translate stored positions */
zzEndRead-= zzStartRead;
zzCurrentPos-= zzStartRead;
zzMarkedPos-= zzStartRead;
zzStartRead = 0;
}
/* is the buffer big enough? */
if (zzCurrentPos >= zzBuffer.length) {
/* if not: blow it up */
char newBuffer[] = new char[zzCurrentPos*2];
System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length);
zzBuffer = newBuffer;
}
/* finally: fill the buffer with new input */
int numRead = zzReader.read(zzBuffer, zzEndRead,
zzBuffer.length-zzEndRead);
if (numRead > 0) {
zzEndRead+= numRead;
return false;
}
// unlikely but not impossible: read 0 characters, but not at end of stream
if (numRead == 0) {
int c = zzReader.read();
if (c == -1) {
return true;
} else {
zzBuffer[zzEndRead++] = (char) c;
return false;
}
}
// numRead < 0
return true;
}
/**
* Closes the input stream.
*/
public final void yyclose() throws java.io.IOException {
zzAtEOF = true; /* indicate end of file */
zzEndRead = zzStartRead; /* invalidate buffer */
if (zzReader != null)
zzReader.close();
}
/**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/
public final void yyreset(java.io.Reader reader) {
zzReader = reader;
zzAtBOL = true;
zzAtEOF = false;
zzEOFDone = false;
zzEndRead = zzStartRead = 0;
zzCurrentPos = zzMarkedPos = 0;
yyline = yychar = yycolumn = 0;
zzLexicalState = YYINITIAL;
}
/**
* Returns the current lexical state.
*/
public final int yystate() {
return zzLexicalState;
}
/**
* Enters a new lexical state
*
* @param newState the new lexical state
*/
public final void yybegin(int newState) {
zzLexicalState = newState;
}
/**
* Returns the text matched by the current regular expression.
*/
public final String yytext() {
return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead );
}
/**
* Returns the character at position <tt>pos</tt> from the
* matched text.
*
* It is equivalent to yytext().charAt(pos), but faster
*
* @param pos the position of the character to fetch.
* A value from 0 to yylength()-1.
*
* @return the character at position pos
*/
public final char yycharat(int pos) {
return zzBuffer[zzStartRead+pos];
}
/**
* Returns the length of the matched text region.
*/
public final int yylength() {
return zzMarkedPos-zzStartRead;
}
/**
* Reports an error that occured while scanning.
*
* In a wellformed scanner (no or only correct usage of
* yypushback(int) and a match-all fallback rule) this method
* will only be called with things that "Can't Possibly Happen".
* If this method is called, something is seriously wrong
* (e.g. a JFlex bug producing a faulty scanner etc.).
*
* Usual syntax/scanner level error handling should be done
* in error fallback rules.
*
* @param errorCode the code of the errormessage to display
*/
private void zzScanError(int errorCode) {
String message;
try {
message = ZZ_ERROR_MSG[errorCode];
}
catch (ArrayIndexOutOfBoundsException e) {
message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR];
}
throw new Error(message);
}
/**
* Pushes the specified amount of characters back into the input stream.
*
* They will be read again by then next call of the scanning method
*
* @param number the number of characters to be read again.
* This number must not be greater than yylength()!
*/
public void yypushback(int number) {
if ( number > yylength() )
zzScanError(ZZ_PUSHBACK_2BIG);
zzMarkedPos -= number;
}
/**
* Contains user EOF-code, which will be executed exactly once,
* when the end of file is reached
*/
private void zzDoEOF() throws java.io.IOException {
if (!zzEOFDone) {
zzEOFDone = true;
yyclose();
}
}
/**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/
public java_cup.runtime.Symbol next_token() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 6:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found y coord. in input");
yybegin (INPUTE);
return new Symbol(InputSym.INPUT6, new Float(yytext()));
}
case 13: break;
case 7:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found z coord. in input");
yybegin (INPUT);
return new Symbol(InputSym.INPUT7, new Float(yytext()));
}
case 14: break;
case 4:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found integer3 in input");
yybegin (INPUTC);
return new Symbol(InputSym.INPUT4, new Integer(yytext()));
}
case 15: break;
case 11:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found the second dash");
yybegin (ITER);
return new Symbol(InputSym.DASH2);
}
case 16: break;
case 5:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found x coord. in input");
yybegin (INPUTD);
return new Symbol(InputSym.INPUT5, new Float(yytext()));
}
case 17: break;
case 12:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found the first dash");
yybegin (INPUT);
return new Symbol(InputSym.DASH1);
}
case 18: break;
case 9:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found Input Orientation");
yybegin(INPUTF);
return new Symbol(InputSym.INPUT1);
}
case 19: break;
case 8:
{ yybegin(IGNOREALL);
return new Symbol(InputSym.SCFDONE);
}
case 20: break;
case 3:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found integer2 in input");
yybegin (INPUTB);
return new Symbol(InputSym.INPUT3, new Integer(yytext()));
}
case 21: break;
case 10:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found Number of steps");
yybegin(ITER);
return new Symbol(InputSym.FOUNDITER);
}
case 22: break;
case 1:
{
}
case 23: break;
case 2:
{ if (Settings.DEBUG) System.out.println("InputFlex: Found integer1 in input");
yybegin (INPUTA);
return new Symbol(InputSym.INPUT2, new Integer(yytext()));
}
case 24: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
zzDoEOF();
{ return new java_cup.runtime.Symbol(InputSym.EOF); }
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
}
/**
* Converts an int token code into the name of the
* token by reflection on the cup symbol class/interface sym
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
private String getTokenName(int token) {
try {
java.lang.reflect.Field [] classFields = InputSym.class.getFields();
for (int i = 0; i < classFields.length; i++) {
if (classFields[i].getInt(null) == token) {
return classFields[i].getName();
}
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
return "UNKNOWN TOKEN";
}
/**
* Same as next_token but also prints the token to standard out
* for debugging.
*
* This code was contributed by Karl Meissner <meissnersd@yahoo.com>
*/
public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException {
java_cup.runtime.Symbol s = next_token();
System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--");
return s;
}
/**
* Runs the scanner on input files.
*
* This is a standalone scanner, it will print any unmatched
* text to System.out unchanged.
*
* @param argv the command line, contains the filenames to run
* the scanner on.
*/
public static void main(String argv[]) {
if (argv.length == 0) {
System.out.println("Usage : java InputLexer <inputfile>");
}
else {
for (int i = 0; i < argv.length; i++) {
InputLexer scanner = null;
try {
scanner = new InputLexer( new java.io.FileReader(argv[i]) );
while ( !scanner.zzAtEOF ) scanner.next_token();
}
catch (java.io.FileNotFoundException e) {
System.out.println("File not found : \""+argv[i]+"\"");
}
catch (java.io.IOException e) {
System.out.println("IO error scanning file \""+argv[i]+"\"");
System.out.println(e);
}
catch (Exception e) {
System.out.println("Unexpected exception:");
e.printStackTrace();
}
}
}
}
}
| 9,198 |
0 | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem | Create_ds/airavata-sandbox/datacat/parsers/src/main/java/org/apache/airavata/datacat/parsers/gridchem/input/InputParser.java | /*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.airavata.datacat.parsers.gridchem.input;
import java_cup.runtime.lr_parser;
import org.apache.airavata.datacat.parsers.gridchem.GridChemQueueParser;
import javax.swing.*;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
public class InputParser extends java_cup.runtime.lr_parser implements GridChemQueueParser {
/** Default constructor. */
public InputParser() {super();}
/** Constructor which sets the default scanner. */
public InputParser(java_cup.runtime.Scanner s) {super(s);}
/**
* Constructor which uses a file reader.
*/
public InputParser(final FileReader fileReader) {
super(new InputLexer(fileReader));
}
/** Production table. */
protected static final short _production_table[][] =
lr_parser.unpackFromStrings(new String[]{
"\000\015\000\002\003\005\000\002\002\004\000\002\004" +
"\003\000\002\005\004\000\002\005\003\000\002\006\006" +
"\000\002\016\004\000\002\016\003\000\002\017\010\000" +
"\002\012\003\000\002\013\003\000\002\014\003\000\002" +
"\015\003"});
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
lr_parser.unpackFromStrings(new String[]{
"\000\031\000\004\005\005\001\002\000\004\004\010\001" +
"\002\000\004\004\uffff\001\002\000\004\002\007\001\002" +
"\000\004\002\000\001\002\000\004\007\015\001\002\000" +
"\006\004\010\006\013\001\002\000\006\004\ufffd\006\ufffd" +
"\001\002\000\004\002\001\001\002\000\006\004\ufffe\006" +
"\ufffe\001\002\000\004\011\016\001\002\000\004\012\024" +
"\001\002\000\006\010\ufffa\011\ufffa\001\002\000\006\010" +
"\021\011\016\001\002\000\006\004\ufffc\006\ufffc\001\002" +
"\000\006\010\ufffb\011\ufffb\001\002\000\004\013\025\001" +
"\002\000\004\013\ufff8\001\002\000\004\016\026\001\002" +
"\000\004\017\ufff7\001\002\000\004\017\030\001\002\000" +
"\004\020\ufff6\001\002\000\004\020\032\001\002\000\006" +
"\010\ufff5\011\ufff5\001\002\000\006\010\ufff9\011\ufff9\001" +
"\002"});
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** <code>reduce_goto</code> table. */
protected static final short[][] _reduce_table =
lr_parser.unpackFromStrings(new String[]{
"\000\031\000\006\003\005\004\003\001\001\000\006\005" +
"\010\006\011\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\004\006\013\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\006\016\017\017\016\001\001\000\004\012\022\001" +
"\001\000\002\001\001\000\004\017\021\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\004\013\026\001\001\000\002\001\001\000\004" +
"\014\030\001\001\000\002\001\001\000\004\015\032\001" +
"\001\000\002\001\001\000\002\001\001"});
/** Access to <code>reduce_goto</code> table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
//Each string is of the format
// z_coord, y_coord, x_coord and atomic number
private ArrayList<String> result = new ArrayList<String>();
private String tempStr = "";
public ArrayList<String> getResult() {
return result;
}
public void addToResult(String value) {
result.add(value);
}
public String getTempStr() {
return tempStr;
}
public void setTempStr(String s) {
this.tempStr = s;
}
/*Adding the parsed data to the hash map */
@Override
public HashMap<String, String> getParsedData() throws Exception {
parse();
HashMap<String,String> results= new HashMap<String,String>();
int zCount=0;
int xCount=0;
int yCount=0;
int atomCount=0;
for(int i=0;i<result.size();i++){
String singleString= result.get(i);
String[] temp=singleString.split(" ");
if(temp.length>1){
String keyString= temp[0];
String dataString=temp[1];
if(keyString.equalsIgnoreCase("Z")){
results.put("InputParser_z_coordinate_"+zCount,dataString);
zCount++;
}else if(keyString.equalsIgnoreCase("Y")){
results.put("InputParser_y_coordinate_"+yCount,dataString);
yCount++;
}else if(keyString.equalsIgnoreCase("X")){
results.put("InputParser_x_coordinate_"+xCount,dataString);
xCount++;
}else if(keyString.equalsIgnoreCase("AtomicNumber")){
results.put("InputParser_atomic_number_"+atomCount,dataString);
atomCount++;
}
}
}
return results;
}
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 1;}
/** <code>EOF</code> Symbol index. */
public int EOF_sym() {return 0;}
/** <code>error</code> Symbol index. */
public int error_sym() {return 1;}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
//__________________________________
public static boolean DEBUG = true;
private static JTable table;
private static final String tableLabel = "SCF Intermediate Results:";
// private static String cycle = "0";
public static JTable getTable() {
return table;
}
public static String getTableLabel() {
return tableLabel;
}
// }
private final InputParser InputParser;
/** Constructor */
CUP$parser$actions(InputParser InputParser) {
this.InputParser = InputParser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // inp7 ::= INPUT7
{
Object RESULT = null;
int in7left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int in7right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float in7 = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: z coordinate "+in7);
InputParser.addToResult("Z "+in7);
CUP$parser$result = new java_cup.runtime.Symbol(11/*inp7*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // inp6 ::= INPUT6
{
Object RESULT = null;
int in6left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int in6right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float in6 = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: y coordinate "+in6);
InputParser.addToResult("Y "+in6);
CUP$parser$result = new java_cup.runtime.Symbol(10/*inp6*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // inp5 ::= INPUT5
{
Object RESULT = null;
int in5left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int in5right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Float in5 = (Float)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: x coordinate "+in5);
InputParser.addToResult("X "+in5);
CUP$parser$result = new java_cup.runtime.Symbol(9/*inp5*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // inp3 ::= INPUT3
{
Object RESULT = null;
int in3left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int in3right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
Integer in3 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
//___________________________________________________________________
if (DEBUG) System.out.println("CUP:Input: atomic number "+in3);
InputParser.addToResult("AtomicNumber "+in3);
CUP$parser$result = new java_cup.runtime.Symbol(8/*inp3*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // cycle2 ::= INPUT2 inp3 INPUT4 inp5 inp6 inp7
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(13/*cycle2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // cycle1 ::= cycle2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(12/*cycle1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // cycle1 ::= cycle1 cycle2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(12/*cycle1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // scfcycle ::= INPUT1 DASH1 cycle1 DASH2
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(4/*scfcycle*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // scfpat ::= scfcycle
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // scfpat ::= scfpat scfcycle
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:Input: in scfpat");
CUP$parser$result = new java_cup.runtime.Symbol(3/*scfpat*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // scfintro ::= FOUNDITER
{
Object RESULT = null;
if (DEBUG) System.out.println("CUP:Input: found the start of Iteration");
CUP$parser$result = new java_cup.runtime.Symbol(2/*scfintro*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // $START ::= startpt EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // startpt ::= scfintro scfpat SCFDONE
{
Object RESULT = null;
CUP$parser$result = new java_cup.runtime.Symbol(1/*startpt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}
| 9,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.