repo
stringlengths
1
191
file
stringlengths
23
351
code
stringlengths
0
5.32M
file_length
int64
0
5.32M
avg_line_length
float64
0
2.9k
max_line_length
int64
0
288k
extension_type
stringclasses
1 value
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/StrTable.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus; import java.util.*; import columbus.logger.LoggerHandler; /** * StrTable class is responsible for storing/loading/saving strings. */ public class StrTable { private static final LoggerHandler logger = new LoggerHandler(StrTable.class, "ColumbusMessages"); public static enum StrType { strDefault, strTmp, strToSave } public StrTable() { this(511); } @SuppressWarnings("unchecked") public StrTable(int buckets) { noBuckets = buckets; strTable = new TreeMap[noBuckets]; count = new int[noBuckets]; for (int i = 0; i < noBuckets; i++) { strTable[i] = new TreeMap<Integer, Pair>(); count[i] = 1; } } private int hash(String string){ int hashHi = 0; int hashLow = 0; if (string == null) return 0; if(string.length() == 0) return 0; char[] convertedString = string.toCharArray(); for (int i = 0; i < convertedString.length; i++) { convertedString[i] &= 0xFF; hashHi = randomNumbers[hashHi ^ convertedString[i]]; } convertedString[0]++; convertedString[0] &= 0xFF; for (int i = 0; i < convertedString.length; i++) hashLow = randomNumbers[hashLow ^ convertedString[i]]; return (hashHi << 8) | hashLow; } private int get(String s, int hashValue, int bucketIndex) { TreeMap<Integer,Pair> bucket = strTable[bucketIndex]; SortedMap<Integer,Pair> sm = bucket.subMap(hashValue << 16, (hashValue << 16) + 0xFFFF); for (Iterator<Map.Entry<Integer,Pair>> it = sm.entrySet().iterator(); it.hasNext(); ) { Map.Entry<Integer,Pair> entry = it.next(); if (entry.getValue().string.equals(s)) return entry.getKey(); } Pair entry = bucket.get((hashValue + 1) << 16); if (entry != null && entry.string.equals(s)) return ((hashValue + 1) << 16); return 0; } public int get(String s) { if(s == null) return 0; if(s.length() == 0) return 0; int hashValue = hash(s); int bucketIndex = hashValue % noBuckets; return get(s, hashValue, bucketIndex); } public String get(int key) { if (key == 0) return ""; int bucketIndex = (key >>> 16) % noBuckets; Pair value = strTable[bucketIndex].get(key); if (value != null) return value.string; return ""; } public int set(String s) { if (s == null) return 0; if (s.length() == 0) return 0; int key = 0; int hashValue = hash(s); int bucketIndex = hashValue % noBuckets; if ((key = get(s, hashValue, bucketIndex)) == 0) { key = (hashValue << 16) | count[bucketIndex]++; if (count[bucketIndex] == 0xFFFF) logger.error("err.java.StrTable.StrTable_Bucket",bucketIndex); strTable[bucketIndex].put(key, new Pair(s, StrType.strDefault)); } return key; } public void setType(String s, StrType type) { if (s == null) return; if (s.length() == 0) return; int key = 0; int hashValue = hash(s); int bucketIndex = hashValue % noBuckets; if ((key = get(s, hashValue, bucketIndex)) == 0) { key =(hashValue << 16) | count[bucketIndex]++; if (count[bucketIndex] == 0xFFFF) logger.error("err.java.StrTable.StrTable_Bucket",bucketIndex); strTable[bucketIndex].put(key, new Pair(s, StrType.strDefault)); } else strTable[bucketIndex].get(key).type = type; } public void setType(int key, StrType type){ int bucket_index = (key >>> 16) % noBuckets; Pair value = strTable[bucket_index].get(key); if (value != null) value.type = type; } public void save(IO io, StrType filterType) { io.writeString("STRTBL"); io.writeInt4(noBuckets); for(int i = 0; i < noBuckets; i++) io.writeUShort2(count[i]); //write out each element for(int i = 0; i < noBuckets; i++) { save(io, filterType, i, false); save(io, filterType, i, true); } // Write out the end of StringTable sign io.writeInt4(0); } private void save(IO io, StrType filterType, int bucketIndex, boolean negative) { for (Map.Entry<Integer,Pair> entry : strTable[bucketIndex].entrySet()) { if (negative && entry.getKey() >= 0) continue; else if (!negative && entry.getKey() < 0) continue; if (filterType == StrType.strTmp) { // In tmp mode nodes with tmp flag will be skipped. if (entry.getValue().type == StrType.strTmp) continue; } else if (filterType == StrType.strToSave) { // In save mode only nodes with save flag will be written out. if(entry.getValue().type != StrType.strToSave) continue; } io.writeInt4(entry.getKey()); // The key (4) io.writeLongString(entry.getValue().string); // Size and characters of the string (4 + n) } } @SuppressWarnings("unchecked") public void load(IO io) { String id = io.readString(6); if (!id.equals("STRTBL")) throw new ColumbusException(logger.formatMessage("ext.java.StrTable.Wrong_file_format")); noBuckets = io.readInt4(); strTable = new TreeMap[noBuckets]; count = new int[noBuckets]; for(int i = 0; i < noBuckets; i++) { strTable[i] = new TreeMap<Integer, Pair>(); count[i] = io.readUShort2(); } int key; String str; int bucketIndex; while ((key = io.readInt4()) != 0) { str = io.readLongString(); bucketIndex = (key >>> 16) % noBuckets; strTable[bucketIndex].put(key, new Pair(str, StrType.strDefault)); } } public void dump() { for (int i = 0; i < strTable.length; i++) { logger.info("info.java.StrTable.Bucket_size", i, strTable[i].entrySet().size()); for (Iterator<Map.Entry<Integer,Pair>> it = strTable[i].entrySet().iterator(); it.hasNext(); ) { Map.Entry<Integer, Pair> entry = it.next(); logger.info("info.java.StrTable.Bucket_Dump", entry.getKey(), entry.getValue().string, entry.getValue().type.ordinal()); } } } protected static class Pair { String string; StrType type; public Pair(String s, StrType st){ string = s; type = st; } } protected static int randomNumbers[] = { 1, 14,110, 25, 97,174,132,119,138,170,125,118, 27,233,140, 51, 87,197,177,107,234,169, 56, 68, 30, 7,173, 73,188, 40, 36, 65, 49,213,104,190, 57,211,148,223, 48,115, 15, 2, 67,186,210, 28, 12,181,103, 70, 22, 58, 75, 78,183,167,238,157,124,147,172,144, 176,161,141, 86, 60, 66,128, 83,156,241, 79, 46,168,198, 41,254, 178, 85,253,237,250,154,133, 88, 35,206, 95,116,252,192, 54,221, 102,218,255,240, 82,106,158,201, 61, 3, 89, 9, 42,155,159, 93, 166, 80, 50, 34,175,195,100, 99, 26,150, 16,145, 4, 33, 8,189, 121, 64, 77, 72,208,245,130,122,143, 55,105,134, 29,164,185,194, 193,239,101,242, 5,171,126, 11, 74, 59,137,228,108,191,232,139, 6, 24, 81, 20,127, 17, 91, 92,251,151,225,207, 21, 98,113,112, 84,226, 18,214,199,187, 13, 32, 94,220,224,212,247,204,196, 43, 249,236, 45,244,111,182,153,136,129, 90,217,202, 19,165,231, 71, 230,142, 96,227, 62,179,246,114,162, 53,160,215,205,180, 47,109, 44, 38, 31,149,135, 0,216, 52, 63, 23, 37, 69, 39,117,146,184, 163,200,222,235,248,243,219, 10,152,131,123,229,203, 76,120,209 }; protected int noBuckets; protected int count[]; protected TreeMap<Integer,Pair> strTable[]; }
7,732
26.228873
124
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/ColumbusException.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus; /** * Exception class for Columbus. */ @SuppressWarnings("serial") public class ColumbusException extends RuntimeException { public ColumbusException() { super(); } public ColumbusException(String message) { super(message); } public ColumbusException(String message, Throwable cause) { super(message, cause); } public ColumbusException(Throwable cause) { super(cause); } }
1,146
23.934783
85
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/ByteArray.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus; import java.util.Arrays; /** * Flexible byte array implementation. */ public class ByteArray implements Comparable<ByteArray> { private int size; private byte[] array; public ByteArray(int initialCapacity) { array = new byte[initialCapacity]; } public ByteArray() { this(8); } public void append(boolean n) { ensureCapacity(1); array[size++] = n ? (byte)1 : 0; } public void append(byte n) { ensureCapacity(1); array[size++] = n; } public void append(short n) { ensureCapacity(2); array[size++] = (byte)((n >>> 0) & 0xFF); array[size++] = (byte)((n >>> 8) & 0xFF); } public void append(char n) { ensureCapacity(2); array[size++] = (byte)((n >>> 0) & 0xFF); array[size++] = (byte)((n >>> 8) & 0xFF); } public void append(int n) { ensureCapacity(4); array[size++] = (byte)((n >>> 0) & 0xFF); array[size++] = (byte)((n >>> 8) & 0xFF); array[size++] = (byte)((n >>> 16) & 0xFF); array[size++] = (byte)((n >>> 24) & 0xFF); } public void append(long n) { ensureCapacity(8); array[size++] = (byte)((n >>> 0) & 0xFF); array[size++] = (byte)((n >>> 8) & 0xFF); array[size++] = (byte)((n >>> 16) & 0xFF); array[size++] = (byte)((n >>> 24) & 0xFF); array[size++] = (byte)((n >>> 32) & 0xFF); array[size++] = (byte)((n >>> 40) & 0xFF); array[size++] = (byte)((n >>> 48) & 0xFF); array[size++] = (byte)((n >>> 56) & 0xFF); } public void append(float n) { append(Float.floatToIntBits(n)); } public void append(double n) { append(Double.doubleToLongBits(n)); } private void ensureCapacity(int increment) { int oldCapacity = array.length; int minCapacity = size + increment; if (oldCapacity < minCapacity) { int newCapacity = (oldCapacity * 3) / 2 + 1; if (newCapacity < minCapacity) newCapacity = minCapacity; array = Arrays.copyOf(array, newCapacity); } } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + size; for (int i = 0; i < size; ++i) { result = prime * result + array[i]; } return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ByteArray other = (ByteArray) obj; if (size != other.size) return false; for (int i = 0; i < size; ++i) { if (array[i] != other.array[i]) return false; } return true; } @Override public int compareTo(ByteArray other) { int minSize = size < other.size ? size : other.size; for (int i = 0; i < minSize; ++i) { if (array[i] < other.array[i]) return -1; if (array[i] > other.array[i]) return 1; } if (size < other.size) return -1; if (size > other.size) return 1; return 0; } @Override public String toString() { return "ByteArray [size=" + size + ", capacity=" + array.length + ", array=" + Arrays.toString(array) + "]"; } }
3,677
23.197368
110
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/IO.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus; import java.io.FilterInputStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.charset.Charset; import java.util.zip.InflaterInputStream; import columbus.logger.LoggerHandler; /** * IO class is responsible for reading/writing fix size data from/to files. */ public class IO { private static final LoggerHandler logger = new LoggerHandler(StrTable.class,"ColumbusMessages"); private static final Charset UTF8_CHARSET = Charset.forName("UTF-8"); public enum IOMode { READ, WRITE } private FilterInputStream in; private BufferedOutputStream out; public IO(String name, IOMode mode) { try { if (mode == IOMode.READ) { in = new BufferedInputStream(new FileInputStream(name)); } else if (mode == IOMode.WRITE) { out = new BufferedOutputStream(new FileOutputStream(name)); } else { throw new ColumbusException(logger.formatMessage("ext.java.Io.Invalid_IO_mode")); } } catch (FileNotFoundException e) { throw new ColumbusException(e); } } public void close() { try { if (in != null) in.close(); else if (out != null) out.close(); } catch (IOException e) { throw new ColumbusException(e); } } public void writeUByte1(int n) { try { out.write((n >>> 0) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeUShort2(int n) { try { out.write((n >>> 0) & 0xFF); out.write((n >>> 8) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeBoolean1(boolean n) { try { out.write(n ? 1 : 0); } catch (IOException e) { throw new ColumbusException(e); } } public void writeByte1(byte n) { try { out.write((n >>> 0) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeShort2(short n) { try { out.write((n >>> 0) & 0xFF); out.write((n >>> 8) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeChar2(char n) { try { out.write((n >>> 0) & 0xFF); out.write((n >>> 8) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeInt4(int n) { try { out.write((n >>> 0) & 0xFF); out.write((n >>> 8) & 0xFF); out.write((n >>> 16) & 0xFF); out.write((n >>> 24) & 0xFF); } catch (IOException e) { throw new ColumbusException(e); } } public void writeLong8(long n) { try { out.write((byte)((n >>> 0) & 0xFF)); out.write((byte)((n >>> 8) & 0xFF)); out.write((byte)((n >>> 16) & 0xFF)); out.write((byte)((n >>> 24) & 0xFF)); out.write((byte)((n >>> 32) & 0xFF)); out.write((byte)((n >>> 40) & 0xFF)); out.write((byte)((n >>> 48) & 0xFF)); out.write((byte)((n >>> 56) & 0xFF)); } catch (IOException e) { throw new ColumbusException(e); } } public void writeFloat4(float n) { writeInt4(Float.floatToIntBits(n)); } public void writeDouble8(double n) { writeLong8(Double.doubleToLongBits(n)); } public void writeShortString(String s) { try { byte[] bytes = s.getBytes(UTF8_CHARSET); int size = bytes.length; if (size > 0xFFFF) throw new ColumbusException(logger.formatMessage("ext.java.Io.The_string_length")); writeUShort2(size); out.write(bytes, 0, size); } catch (IOException e) { throw new ColumbusException(e); } } public void writeLongString(String s) { try { byte[] bytes = s.getBytes(UTF8_CHARSET); writeInt4(bytes.length); out.write(bytes, 0, bytes.length); } catch (IOException e) { throw new ColumbusException(e); } } public void writeString(String s) { try { byte[] bytes = s.getBytes(UTF8_CHARSET); out.write(bytes, 0, bytes.length); } catch (IOException e) { throw new ColumbusException(e); } } public short readUByte1() { try { long n = in.read(); return (short)n; } catch (IOException e) { throw new ColumbusException(e); } } public int readUShort2() { try { long n = in.read(); n |= in.read() << 8; return (int)n; } catch (IOException e) { throw new ColumbusException(e); } } public long readUInt4() { try { long n = in.read(); n |= in.read() << 8; n |= in.read() << 16; n |= (long)in.read() << 24; return (long)n; } catch (IOException e) { throw new ColumbusException(e); } } public boolean readBoolean1() { try { int n = in.read(); return n != 0; } catch (IOException e) { throw new ColumbusException(e); } } public byte readByte1() { try { int n = in.read(); return (byte)n; } catch (IOException e) { throw new ColumbusException(e); } } public short readShort2() { try { int n = in.read(); n |= in.read() << 8; return (short)n; } catch (IOException e) { throw new ColumbusException(e); } } public char readChar2() { try { int n = in.read(); n |= in.read() << 8; return (char)n; } catch (IOException e) { throw new ColumbusException(e); } } public int readInt4() { try { int n = in.read(); n |= in.read() << 8; n |= in.read() << 16; n |= in.read() << 24; return n; } catch (IOException e) { throw new ColumbusException(e); } } public long readLong8() { try { long n = in.read(); n |= in.read() << 8; n |= in.read() << 16; n |= (long)in.read() << 24; n |= (long)in.read() << 32; n |= (long)in.read() << 40; n |= (long)in.read() << 48; n |= (long)in.read() << 56; return n; } catch (IOException e) { throw new ColumbusException(e); } } public float readFloat4() { return Float.intBitsToFloat(readInt4()); } public double readDouble8() { return Double.longBitsToDouble(readLong8()); } public String readShortString() { return readString(readUShort2()); } public String readLongString() { return readString(readInt4()); } public String readString(int size) { try { byte[] array = new byte[size]; int offset = 0; int read = in.read(array, offset, size); while (read != size) { size -= read; offset += read; read = in.read(array, offset, size); if (read == -1) throw new ColumbusException(logger.formatMessage("ext.java.Io.EOF_reached_while_reading")); } return new String(array, UTF8_CHARSET); } catch (IOException e) { throw new ColumbusException(e); } } public void skip(long bytes) { try { long skipped = in.skip(bytes); while (skipped != bytes) { bytes -= skipped; skipped = in.skip(bytes); } } catch (IOException e) { throw new ColumbusException(e); } } public void setZipedReadMode() { if (in != null) in = new InflaterInputStream(in); } }
7,548
21.268437
98
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/CsiHeader.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus; import java.util.TreeMap; import java.util.Map.Entry; import columbus.logger.LoggerHandler; /** * CsiHeader class is responsible for storing/loading/saving the columbus schema instance headers. */ public class CsiHeader { private static final LoggerHandler logger = new LoggerHandler(CsiHeader.class, "ColumbusMessages"); public static final String csih_True = "1"; public static final String csih_False = "0"; public static final String csih_Type = "Type"; public static final String csih_BinaryVersion = "BinaryVersion"; public static final String csih_APIVersion = "APIVersion"; public static final String csih_FullAnalysis = "FullAnalysis"; public static final String csih_SchemaFilter = "SchemaFilter"; public static final String csih_PrecompiledHeader = "PrecompiledHeader"; public static final String csih_UsePrecompiledHeader = "UsePrecompileHeader"; public static final String csih_NumOfIncrLinked = "NumberOfIncrLinked"; public static final String csih_PreanalyzedIncludesUsed = "PreanalyzedIncludesUsed"; public static final String csih_OriginalLocation = "OriginalLocation"; public static final String csih_PsiKind = "PsiKind"; public static final String csih_Language = "Language"; public static final String csih_ChangesetID = "ChangesetID"; protected TreeMap<String, String> header = new TreeMap<String, String>(); public CsiHeader() { } public boolean add(String key, String value) { if (header.containsKey(key)) return false; header.put(key, value); return true; } public boolean addBoolean(String key, boolean value) { return add(key, value ? csih_True : csih_False); } public boolean addInt(String key, int value) { return add(key, Integer.toString(value)); } public String get(String key) { return header.get(key); } public Boolean getBoolean(String key) { String value = header.get(key); if (value == null) return null; return value.equals(csih_True) ? true : false; } public Integer getInt(String key) { String value = header.get(key); if (value == null) return null; return Integer.parseInt(value); } public void write(IO io) { io.writeInt4(header.size()); for (Entry<String, String> entry : header.entrySet()) { io.writeShortString(entry.getKey()); io.writeShortString(entry.getValue()); } } public void read(IO io) { int num = io.readInt4(); for (int i = 0; i < num; i++) { String key = io.readShortString(); String value = io.readShortString(); add(key, value); } } public void dump() { for (Entry<String, String> entry : header.entrySet()) { logger.info("info.java.CSI.dump", entry.getKey(), entry.getValue()); } } }
3,414
29.765766
100
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/EdgeList.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import columbus.java.asg.base.Base; import columbus.logger.LoggerHandler; /** * Class for storing and iterating edges. * @param <T> The base type of the nodes in this edge. */ public class EdgeList<T extends Base> { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(EdgeList.class, Constant.LoggerPropertyFile); @SuppressWarnings("rawtypes") private static final EdgeList EMPTY_LIST = new EdgeList(null); @SuppressWarnings("unchecked") public static final <T extends Base> EdgeList<T> emptyList() { return (EdgeList<T>)EMPTY_LIST; } private Factory factory; private int[] array; private int realSize; public EdgeList(Factory factory) { this.factory = factory; } public void add(T node) { add(node.getId()); } public void add(int value) { if (array == null) array = new int[2]; if (array.length > realSize) { array[realSize] = value; realSize++; } else { resize(); array[realSize] = value; realSize++; } } private void resize() { int oldCapacity = array.length; int newCapacity = (oldCapacity * 3) / 2 + 1; int oldData[] = array; array = new int[newCapacity]; System.arraycopy(oldData, 0, array, 0, realSize); } public int size() { return realSize; } public boolean isEmpty() { return realSize == 0; } public void trimToSize() { int oldCapacity = array.length; if (realSize < oldCapacity) { int oldData[] = array; array = new int[realSize]; System.arraycopy(oldData, 0, array, 0, realSize); } } public EdgeIterator<T> iterator() { return new Itr(); } private class Itr implements EdgeIterator<T> { private final LoggerHandler logger = new LoggerHandler(Itr.class, Constant.LoggerPropertyFile); protected int i; public boolean hasNext() { if (array == null) return false; int j = i; while (j < realSize && (!factory.getExist(array[j]) || factory.getIsFiltered(array[j]))) { ++j; } return j < realSize; } @SuppressWarnings("unchecked") public T next() { if (array == null) throw new JavaException(logger.formatMessage("ex.java.xxx.Next_element_does_not_exist") ); while (i < realSize && (!factory.getExist(array[i]) || factory.getIsFiltered(array[i]))) { ++i; } if (i >= realSize) throw new JavaException(logger.formatMessage("ex.java.xxx.Next_element_does_not_exist")); return (T)factory.getRef(array[i++]); } } }
3,188
23.914063
108
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/JavaException.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import columbus.ColumbusException; /** * Exception class for the 'java' graph. */ @SuppressWarnings("serial") public class JavaException extends ColumbusException { /** * Constructor. */ public JavaException() { super(); } /** * Constructor. * @param message The detail message. */ public JavaException(String message) { super(message); } /** * Constructor. * @param message The detail message. * @param cause The cause of the exception. */ public JavaException(String message, Throwable cause) { super(message, cause); } /** * Constructor. * @param cause The cause of the exception. */ public JavaException(Throwable cause) { super(cause); } }
1,458
21.796875
85
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/Range.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import columbus.StrTable; import columbus.logger.LoggerHandler; /** * Class for storing and retrieving position informations. */ public class Range { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(Range.class, Constant.LoggerPropertyFile); private StrTable strTable; private int path; private int line; private int endLine; private int wideLine; private int wideEndLine; private int col; private int endCol; private int wideCol; private int wideEndCol; public Range(StrTable st) { strTable = st; } public Range(StrTable st, String pathString, int line, int col, int endLine, int endCol, int wideLine, int wideCol, int wideEndLine, int wideEndCol) { strTable = st; setPath(pathString); this.line = line; this.col = col; this.endLine = endLine; this.endCol = endCol; this.wideLine = wideLine; this.wideCol = wideCol; this.wideEndLine = wideEndLine; this.wideEndCol = wideEndCol; } public Range(StrTable st, int pathKey, int line, int col, int endLine, int endCol, int wideLine, int wideCol, int wideEndLine, int wideEndCol) { strTable = st; path = pathKey; this.line = line; this.col = col; this.endLine = endLine; this.endCol = endCol; this.wideLine = wideLine; this.wideCol = wideCol; this.wideEndLine = wideEndLine; this.wideEndCol = wideEndCol; } public Range(StrTable st, Range range) { strTable = st; if (range.strTable == st) path = range.path; else path = strTable.set(range.getPath()); line = range.line; endLine = range.endLine; wideLine = range.wideLine; wideEndLine = range.wideEndLine; col = range.col; endCol = range.endCol; wideCol = range.wideCol; wideEndCol = range.wideEndCol; } public Range(Range range) { this(range.getStringTable(), range); } public StrTable getStringTable() { return strTable; } public String getPath() { return strTable.get(path); } public int getPathKey() { return path; } public void setPath(String s) { path = strTable.set(s); } public void setPathKey(int pathKey) { path = pathKey; } public int getLine() { return line; } public void setLine(int i) { line = i; } public int getEndLine() { return endLine; } public void setEndLine(int i) { endLine = i; } public int getWideLine() { return wideLine; } public void setWideLine(int i) { wideLine = i; } public int getWideEndLine() { return wideEndLine; } public void setWideEndLine(int i) { wideEndLine = i; } public int getCol() { return col; } public void setCol(int i) { col = i; } public int getEndCol() { return endCol; } public void setEndCol(int i) { endCol = i; } public int getWideCol() { return wideCol; } public void setWideCol(int i) { wideCol = i; } public int getWideEndCol() { return wideEndCol; } public void setWideEndCol(int i) { wideEndCol = i; } }
3,669
19.276243
151
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/Constant.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; /** * Predefined constants. */ public class Constant { /** * The API version. */ public static final String APIVersion = "3.0.12"; /** * The binary version. */ public static final String BinaryVersion = "3.0.12"; /** * The messages resource file. */ public static final String LoggerPropertyFile = "JavaMessages"; }
1,100
24.022727
85
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/Factory.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import columbus.ByteArray; import columbus.CsiHeader; import columbus.IO; import columbus.StrTable; import columbus.IO.IOMode; import columbus.StrTable.StrType; import columbus.java.asg.algorithms.AlgorithmPreorder; import columbus.java.asg.base.Base; import columbus.java.asg.struc.Package; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.VisitorSave; import columbus.logger.LoggerHandler; import columbus.java.asg.base.BlockCommentImpl; import columbus.java.asg.base.JavadocCommentImpl; import columbus.java.asg.base.LineCommentImpl; import columbus.java.asg.expr.AnnotatedTypeExpressionImpl; import columbus.java.asg.expr.ArrayAccessImpl; import columbus.java.asg.expr.ArrayTypeExpressionImpl; import columbus.java.asg.expr.AssignmentImpl; import columbus.java.asg.expr.BooleanLiteralImpl; import columbus.java.asg.expr.CharacterLiteralImpl; import columbus.java.asg.expr.ClassLiteralImpl; import columbus.java.asg.expr.ConditionalImpl; import columbus.java.asg.expr.DoubleLiteralImpl; import columbus.java.asg.expr.ErroneousImpl; import columbus.java.asg.expr.ErroneousTypeExpressionImpl; import columbus.java.asg.expr.ExternalTypeExpressionImpl; import columbus.java.asg.expr.FieldAccessImpl; import columbus.java.asg.expr.FloatLiteralImpl; import columbus.java.asg.expr.IdentifierImpl; import columbus.java.asg.expr.InfixExpressionImpl; import columbus.java.asg.expr.InstanceOfImpl; import columbus.java.asg.expr.IntegerLiteralImpl; import columbus.java.asg.expr.LambdaImpl; import columbus.java.asg.expr.LongLiteralImpl; import columbus.java.asg.expr.MarkerAnnotationImpl; import columbus.java.asg.expr.MemberReferenceImpl; import columbus.java.asg.expr.MethodInvocationImpl; import columbus.java.asg.expr.NewArrayImpl; import columbus.java.asg.expr.NewClassImpl; import columbus.java.asg.expr.NormalAnnotationImpl; import columbus.java.asg.expr.NullLiteralImpl; import columbus.java.asg.expr.ParenthesizedExpressionImpl; import columbus.java.asg.expr.PostfixExpressionImpl; import columbus.java.asg.expr.PrefixExpressionImpl; import columbus.java.asg.expr.PrimitiveTypeExpressionImpl; import columbus.java.asg.expr.QualifiedTypeExpressionImpl; import columbus.java.asg.expr.SimpleTypeExpressionImpl; import columbus.java.asg.expr.SingleElementAnnotationImpl; import columbus.java.asg.expr.StringLiteralImpl; import columbus.java.asg.expr.SuperImpl; import columbus.java.asg.expr.ThisImpl; import columbus.java.asg.expr.TypeApplyExpressionImpl; import columbus.java.asg.expr.TypeCastImpl; import columbus.java.asg.expr.TypeIntersectionExpressionImpl; import columbus.java.asg.expr.TypeUnionExpressionImpl; import columbus.java.asg.expr.WildcardExpressionImpl; import columbus.java.asg.module.ExportsImpl; import columbus.java.asg.module.OpensImpl; import columbus.java.asg.module.ProvidesImpl; import columbus.java.asg.module.RequiresImpl; import columbus.java.asg.module.UsesImpl; import columbus.java.asg.statm.AssertImpl; import columbus.java.asg.statm.BasicForImpl; import columbus.java.asg.statm.BlockImpl; import columbus.java.asg.statm.BreakImpl; import columbus.java.asg.statm.CaseImpl; import columbus.java.asg.statm.ContinueImpl; import columbus.java.asg.statm.DefaultImpl; import columbus.java.asg.statm.DoImpl; import columbus.java.asg.statm.EmptyImpl; import columbus.java.asg.statm.EnhancedForImpl; import columbus.java.asg.statm.ExpressionStatementImpl; import columbus.java.asg.statm.HandlerImpl; import columbus.java.asg.statm.IfImpl; import columbus.java.asg.statm.LabeledStatementImpl; import columbus.java.asg.statm.ReturnImpl; import columbus.java.asg.statm.SwitchImpl; import columbus.java.asg.statm.SynchronizedImpl; import columbus.java.asg.statm.ThrowImpl; import columbus.java.asg.statm.TryImpl; import columbus.java.asg.statm.WhileImpl; import columbus.java.asg.struc.AnnotationTypeImpl; import columbus.java.asg.struc.AnnotationTypeElementImpl; import columbus.java.asg.struc.AnonymousClassImpl; import columbus.java.asg.struc.ClassImpl; import columbus.java.asg.struc.ClassGenericImpl; import columbus.java.asg.struc.CompilationUnitImpl; import columbus.java.asg.struc.EnumImpl; import columbus.java.asg.struc.EnumConstantImpl; import columbus.java.asg.struc.ImportImpl; import columbus.java.asg.struc.InstanceInitializerBlockImpl; import columbus.java.asg.struc.InterfaceImpl; import columbus.java.asg.struc.InterfaceGenericImpl; import columbus.java.asg.struc.MethodImpl; import columbus.java.asg.struc.MethodGenericImpl; import columbus.java.asg.struc.ModuleImpl; import columbus.java.asg.struc.ModuleDeclarationImpl; import columbus.java.asg.struc.PackageImpl; import columbus.java.asg.struc.PackageDeclarationImpl; import columbus.java.asg.struc.ParameterImpl; import columbus.java.asg.struc.StaticInitializerBlockImpl; import columbus.java.asg.struc.TypeParameterImpl; import columbus.java.asg.struc.VariableImpl; import columbus.java.asg.type.ArrayTypeImpl; import columbus.java.asg.type.BooleanTypeImpl; import columbus.java.asg.type.ByteTypeImpl; import columbus.java.asg.type.CharTypeImpl; import columbus.java.asg.type.ClassTypeImpl; import columbus.java.asg.type.DoubleTypeImpl; import columbus.java.asg.type.ErrorTypeImpl; import columbus.java.asg.type.FloatTypeImpl; import columbus.java.asg.type.IntTypeImpl; import columbus.java.asg.type.IntersectionTypeImpl; import columbus.java.asg.type.LongTypeImpl; import columbus.java.asg.type.LowerBoundedWildcardTypeImpl; import columbus.java.asg.type.MethodTypeImpl; import columbus.java.asg.type.ModuleTypeImpl; import columbus.java.asg.type.NoTypeImpl; import columbus.java.asg.type.NullTypeImpl; import columbus.java.asg.type.PackageTypeImpl; import columbus.java.asg.type.ParameterizedTypeImpl; import columbus.java.asg.type.ShortTypeImpl; import columbus.java.asg.type.TypeVariableImpl; import columbus.java.asg.type.UnboundedWildcardTypeImpl; import columbus.java.asg.type.UnionTypeImpl; import columbus.java.asg.type.UpperBoundedWildcardTypeImpl; import columbus.java.asg.type.VoidTypeImpl; import columbus.java.asg.base.BlockComment; import columbus.java.asg.base.JavadocComment; import columbus.java.asg.base.LineComment; import columbus.java.asg.type.ArrayType; import columbus.java.asg.type.BooleanType; import columbus.java.asg.type.ByteType; import columbus.java.asg.type.CharType; import columbus.java.asg.type.ClassType; import columbus.java.asg.type.DoubleType; import columbus.java.asg.type.ErrorType; import columbus.java.asg.type.FloatType; import columbus.java.asg.type.IntType; import columbus.java.asg.type.LongType; import columbus.java.asg.type.LowerBoundedWildcardType; import columbus.java.asg.type.MethodType; import columbus.java.asg.type.NoType; import columbus.java.asg.type.NullType; import columbus.java.asg.type.PackageType; import columbus.java.asg.type.ParameterizedType; import columbus.java.asg.type.ShortType; import columbus.java.asg.type.TypeVariable; import columbus.java.asg.type.UnboundedWildcardType; import columbus.java.asg.type.UnionType; import columbus.java.asg.type.UpperBoundedWildcardType; import columbus.java.asg.type.VoidType; /** * Factory, which handles (creates, deletes, sets their properties) nodes. */ public final class Factory { private static final LoggerHandler logger = new LoggerHandler(Factory.class, Constant.LoggerPropertyFile); /** Reference to the StringTable. */ private StrTable strTable; /** Container where the references to nodes are stored. */ private ArrayList<Base> container = new ArrayList<Base>(); /** Reference to the root. */ private Package root; /** The Filter. */ private Filter filter; /** Stores whether the filter is turned on or off. */ private boolean filterOn; /** Map for storing special nodes and their inner representation. */ private Map<ByteArray, Base> apspecNodes = new HashMap<ByteArray, Base>(); /** Map for storing 'BooleanType' type special nodes and their inner representation. */ private BooleanType apspecNodeBooleanType = null; /** Map for storing 'ByteType' type special nodes and their inner representation. */ private ByteType apspecNodeByteType = null; /** Map for storing 'CharType' type special nodes and their inner representation. */ private CharType apspecNodeCharType = null; /** Map for storing 'DoubleType' type special nodes and their inner representation. */ private DoubleType apspecNodeDoubleType = null; /** Map for storing 'ErrorType' type special nodes and their inner representation. */ private ErrorType apspecNodeErrorType = null; /** Map for storing 'FloatType' type special nodes and their inner representation. */ private FloatType apspecNodeFloatType = null; /** Map for storing 'IntType' type special nodes and their inner representation. */ private IntType apspecNodeIntType = null; /** Map for storing 'LongType' type special nodes and their inner representation. */ private LongType apspecNodeLongType = null; /** Map for storing 'NoType' type special nodes and their inner representation. */ private NoType apspecNodeNoType = null; /** Map for storing 'NullType' type special nodes and their inner representation. */ private NullType apspecNodeNullType = null; /** Map for storing 'ShortType' type special nodes and their inner representation. */ private ShortType apspecNodeShortType = null; /** Map for storing 'VoidType' type special nodes and their inner representation. */ private VoidType apspecNodeVoidType = null; /** * Nested iterator class which enumerates the nodes. */ public class Iterator { private final LoggerHandler logger = new LoggerHandler(Iterator.class, Constant.LoggerPropertyFile); private int i; private int size = container.size(); /** * Constructor. */ private Iterator() { } /** * Examines the existence of the next node. * @return Returns true if a next node exists. */ public boolean hasNext() { int j = i; while (j < size && (container.get(j) == null || getIsFiltered(j))) { ++j; } return j < size; } /** * Returns a reference of the next node ({@link columbus.java.asg.base.Base Base}). * @return Reference of the next node. */ public Base next() { while (i < size && (container.get(i) == null || getIsFiltered(i))) { ++i; } if (i >= size) { throw new JavaException(logger.formatMessage("ex.java.xxx.Next_element_does_not_exist")); } return container.get(i++); } } /** * Constructor. * @param st Reference to the StrTable. */ public Factory(StrTable st) { strTable = st; filter = new Filter(this); filterOn = true; root = (Package)createNode(NodeKind.ndkPackage, 100); root.setName("<root_package>"); root.setQualifiedName("<root_package>"); init(); } protected void clear() { // Deleting all nodes from the factory container.clear(); if (filter != null) { filter = new Filter(this); } apspecNodes.clear(); apspecNodeBooleanType = null; apspecNodeByteType = null; apspecNodeCharType = null; apspecNodeDoubleType = null; apspecNodeErrorType = null; apspecNodeFloatType = null; apspecNodeIntType = null; apspecNodeLongType = null; apspecNodeNoType = null; apspecNodeNullType = null; apspecNodeShortType = null; apspecNodeVoidType = null; } /** * Saves the graph. * @param filename The graph is saved into this file. * @param header The header information (also will be saved). */ public void save(String filename, CsiHeader header) { save(filename, header, StrType.strDefault, true); } /** * Saves the graph. * @param filename The graph is saved into this file. * @param header The header information (also will be saved). * @param strType Type of StrTable entries to save. * @param usedOnly Save only 'used' special nodes, or all of them. */ public void save(String filename, CsiHeader header, StrType strType, boolean usedOnly) { IO io = new IO(filename, IOMode.WRITE); // saving header ... header.add(CsiHeader.csih_Type, "JavaLanguage"); header.add(CsiHeader.csih_APIVersion, Constant.APIVersion); header.add(CsiHeader.csih_BinaryVersion, Constant.BinaryVersion); header.write(io); // saving the ASG AlgorithmPreorder algPre = new AlgorithmPreorder(); algPre.setVisitSpecialNodes(true, usedOnly); VisitorSave vSave = new VisitorSave(io); algPre.run(this, vSave); // Writing the ENDMARK! io.writeInt4(0); // NodeId io.writeUShort2(0); // NodeKind // saving string table ... strTable.save(io, strType); io.close(); } /** * Loads the graph. * @param filename The graph is loaded from this file. * @param header The header information (also will be loaded). */ public void load(String filename, CsiHeader header) { clear(); IO io = new IO(filename, IOMode.READ); // loading header ... header.read(io); // Checking the type String type = header.get(CsiHeader.csih_Type); if (type == null) throw new JavaException(logger.formatMessage("ex.java.Factory.Missing_file_type_information")); if (!type.equals("JavaLanguage")) throw new JavaException(logger.formatMessage("ex.java.Factory.Wrong_file_type_information")); // Checking API version String apiVersion = header.get(CsiHeader.csih_APIVersion); if (apiVersion == null) throw new JavaException(logger.formatMessage("ex.java.Factory.Missing_API_version_information")); if (!apiVersion.equals(Constant.APIVersion)) throw new JavaException(logger.formatMessage("ex.java.Factory.Wrong_API_version", Constant.APIVersion , apiVersion )); // Checking binary version String binVersion = header.get(CsiHeader.csih_BinaryVersion); if (binVersion == null) throw new JavaException(logger.formatMessage("ex.java.Factory.Missing_binary_version_information")); if (!binVersion.equals(Constant.BinaryVersion)) throw new JavaException(logger.formatMessage("ex.java.Factory.Wrong_binary_version", Constant.BinaryVersion , binVersion)); // loading the ASG int id = io.readInt4(); NodeKind kind = NodeKind.values()[io.readUShort2()]; while (id != 0) { createNode(kind, id); container.get(id).load(io); id = io.readInt4(); kind = NodeKind.values()[io.readUShort2()]; } // loading the string table strTable.load(io); root = (Package)container.get(100); io.close(); init(); } /** * Turns the Filter on. */ public void turnFilterOn() { filterOn = true; } /** * Turns the Filter off. */ public void turnFilterOff() { filterOn = false; } /** * Gives back the state of the Filter. * @return Returns true if the Filter is turned on, otherwise returns false. */ public boolean getIsFilterTurnedOn() { return filterOn; } /** * Initializes the filter. */ public void initializeFilter() { filter.initializeFilter(); } /** * Tells whether the given node is filtered or not. * @param id The id of the node. * @throws JavaException Throws JavaException if the id is too large. * @return Returns true if the Node is filtered and returns false if it isn't (or the filter mode is turned off). */ public boolean getIsFiltered(int id) { return !filterOn ? false : filter.getIsFiltered(id); } /** * Filters out the given node and all of its descendants. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setFiltered(int id) { filter.setFiltered(id); } /** * Sets the state of the node, all of its descendants and all of its ancestors to not filtered. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setNotFiltered(int id) { filter.setNotFiltered(id); } /** * Filter out only the given node (without its children). * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setFilteredThisNodeOnly(int id) { filter.setFilteredThisNodeOnly(id); } /** * Sets the state of the given node (without its children) to not filtered. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setNotFilteredThisNodeOnly(int id) { filter.setNotFilteredThisNodeOnly(id); } /** * Saves the filter. * @param filename The name of the filter file. */ public void saveFilter(String filename) { filter.save(filename); } /** * Loads the filter. * @param filename The name of the filter file. */ public void loadFilter(String filename) { filter.load(filename); } /** * Gives back a reference to the StringTable. * @return Reference to the StringTable. */ public StrTable getStringTable() { return strTable; } /** * Gives back a reference to the root node. * @return The reference to the root node. */ public Package getRoot() { return root; } /** * Decides whether it is a valid id or not. * @param id The id whose validity is examined. * @return Returns true if a node belongs to the id. */ public boolean getExist(int id) { if (container.size() <= id) //throw new JavaException(logger.formatMessage("ex.java.Factory.Invalid_id", id) ); return false; return container.get(id) != null; } /** * Gives back a reference to the node. * @param id The id of the node. * @throws JavaException Throws JavaException if there is no node for the id. * @return Reference to the node. */ public Base getRef(int id) { Base p = null; if (id < container.size()) p = container.get(id); if (p == null) throw new JavaException(logger.formatMessage("ex.java.Factory.Invalid_id", id) ); return p; } /** * Gives back the NodeKind of a node. * @param id The id of the node. * @throws JavaException Throws JavaException if there is no node for the id. * @return The NodeKind of the node. */ public NodeKind getNodeKind(int id) { return getRef(id).getNodeKind(); } /** * Creates and returns an iterator, which enumerates the nodes in the graph. * @return An iterator to the nodes. */ public Iterator iterator() { return new Iterator(); } /** * Returns the number of nodes. * @return The number of nodes. */ public int size() { return container.size(); } /** * Tells whether the factory has nodes or not (O(n)). * @return Returns true if there is not any node. */ public boolean isEmpty() { for (int i = 0; i < container.size(); i++) if (container.get(i) != null) return false; return true; } /** * Creates a new node, insert it into the container and return with it. * @param ndk The kind of the node. * @throws JavaException If an invalid (or an abstract) NodeKind is given, JavaException is thrown. * @return Reference to the new node. */ public Base createNode(NodeKind ndk) { Base p = null; switch (ndk) { case ndkAnnotatedTypeExpression: p = new AnnotatedTypeExpressionImpl(container.size(), this); break; case ndkArrayAccess: p = new ArrayAccessImpl(container.size(), this); break; case ndkArrayTypeExpression: p = new ArrayTypeExpressionImpl(container.size(), this); break; case ndkAssignment: p = new AssignmentImpl(container.size(), this); break; case ndkBooleanLiteral: p = new BooleanLiteralImpl(container.size(), this); break; case ndkCharacterLiteral: p = new CharacterLiteralImpl(container.size(), this); break; case ndkClassLiteral: p = new ClassLiteralImpl(container.size(), this); break; case ndkConditional: p = new ConditionalImpl(container.size(), this); break; case ndkDoubleLiteral: p = new DoubleLiteralImpl(container.size(), this); break; case ndkErroneous: p = new ErroneousImpl(container.size(), this); break; case ndkErroneousTypeExpression: p = new ErroneousTypeExpressionImpl(container.size(), this); break; case ndkExternalTypeExpression: p = new ExternalTypeExpressionImpl(container.size(), this); break; case ndkFieldAccess: p = new FieldAccessImpl(container.size(), this); break; case ndkFloatLiteral: p = new FloatLiteralImpl(container.size(), this); break; case ndkIdentifier: p = new IdentifierImpl(container.size(), this); break; case ndkInfixExpression: p = new InfixExpressionImpl(container.size(), this); break; case ndkInstanceOf: p = new InstanceOfImpl(container.size(), this); break; case ndkIntegerLiteral: p = new IntegerLiteralImpl(container.size(), this); break; case ndkLambda: p = new LambdaImpl(container.size(), this); break; case ndkLongLiteral: p = new LongLiteralImpl(container.size(), this); break; case ndkMarkerAnnotation: p = new MarkerAnnotationImpl(container.size(), this); break; case ndkMemberReference: p = new MemberReferenceImpl(container.size(), this); break; case ndkMethodInvocation: p = new MethodInvocationImpl(container.size(), this); break; case ndkNewArray: p = new NewArrayImpl(container.size(), this); break; case ndkNewClass: p = new NewClassImpl(container.size(), this); break; case ndkNormalAnnotation: p = new NormalAnnotationImpl(container.size(), this); break; case ndkNullLiteral: p = new NullLiteralImpl(container.size(), this); break; case ndkParenthesizedExpression: p = new ParenthesizedExpressionImpl(container.size(), this); break; case ndkPostfixExpression: p = new PostfixExpressionImpl(container.size(), this); break; case ndkPrefixExpression: p = new PrefixExpressionImpl(container.size(), this); break; case ndkPrimitiveTypeExpression: p = new PrimitiveTypeExpressionImpl(container.size(), this); break; case ndkQualifiedTypeExpression: p = new QualifiedTypeExpressionImpl(container.size(), this); break; case ndkSimpleTypeExpression: p = new SimpleTypeExpressionImpl(container.size(), this); break; case ndkSingleElementAnnotation: p = new SingleElementAnnotationImpl(container.size(), this); break; case ndkStringLiteral: p = new StringLiteralImpl(container.size(), this); break; case ndkSuper: p = new SuperImpl(container.size(), this); break; case ndkThis: p = new ThisImpl(container.size(), this); break; case ndkTypeApplyExpression: p = new TypeApplyExpressionImpl(container.size(), this); break; case ndkTypeCast: p = new TypeCastImpl(container.size(), this); break; case ndkTypeIntersectionExpression: p = new TypeIntersectionExpressionImpl(container.size(), this); break; case ndkTypeUnionExpression: p = new TypeUnionExpressionImpl(container.size(), this); break; case ndkWildcardExpression: p = new WildcardExpressionImpl(container.size(), this); break; case ndkExports: p = new ExportsImpl(container.size(), this); break; case ndkOpens: p = new OpensImpl(container.size(), this); break; case ndkProvides: p = new ProvidesImpl(container.size(), this); break; case ndkRequires: p = new RequiresImpl(container.size(), this); break; case ndkUses: p = new UsesImpl(container.size(), this); break; case ndkAssert: p = new AssertImpl(container.size(), this); break; case ndkBasicFor: p = new BasicForImpl(container.size(), this); break; case ndkBlock: p = new BlockImpl(container.size(), this); break; case ndkBreak: p = new BreakImpl(container.size(), this); break; case ndkCase: p = new CaseImpl(container.size(), this); break; case ndkContinue: p = new ContinueImpl(container.size(), this); break; case ndkDefault: p = new DefaultImpl(container.size(), this); break; case ndkDo: p = new DoImpl(container.size(), this); break; case ndkEmpty: p = new EmptyImpl(container.size(), this); break; case ndkEnhancedFor: p = new EnhancedForImpl(container.size(), this); break; case ndkExpressionStatement: p = new ExpressionStatementImpl(container.size(), this); break; case ndkHandler: p = new HandlerImpl(container.size(), this); break; case ndkIf: p = new IfImpl(container.size(), this); break; case ndkLabeledStatement: p = new LabeledStatementImpl(container.size(), this); break; case ndkReturn: p = new ReturnImpl(container.size(), this); break; case ndkSwitch: p = new SwitchImpl(container.size(), this); break; case ndkSynchronized: p = new SynchronizedImpl(container.size(), this); break; case ndkThrow: p = new ThrowImpl(container.size(), this); break; case ndkTry: p = new TryImpl(container.size(), this); break; case ndkWhile: p = new WhileImpl(container.size(), this); break; case ndkAnnotationType: p = new AnnotationTypeImpl(container.size(), this); break; case ndkAnnotationTypeElement: p = new AnnotationTypeElementImpl(container.size(), this); break; case ndkAnonymousClass: p = new AnonymousClassImpl(container.size(), this); break; case ndkClass: p = new ClassImpl(container.size(), this); break; case ndkClassGeneric: p = new ClassGenericImpl(container.size(), this); break; case ndkCompilationUnit: p = new CompilationUnitImpl(container.size(), this); break; case ndkEnum: p = new EnumImpl(container.size(), this); break; case ndkEnumConstant: p = new EnumConstantImpl(container.size(), this); break; case ndkImport: p = new ImportImpl(container.size(), this); break; case ndkInstanceInitializerBlock: p = new InstanceInitializerBlockImpl(container.size(), this); break; case ndkInterface: p = new InterfaceImpl(container.size(), this); break; case ndkInterfaceGeneric: p = new InterfaceGenericImpl(container.size(), this); break; case ndkMethod: p = new MethodImpl(container.size(), this); break; case ndkMethodGeneric: p = new MethodGenericImpl(container.size(), this); break; case ndkModule: p = new ModuleImpl(container.size(), this); break; case ndkModuleDeclaration: p = new ModuleDeclarationImpl(container.size(), this); break; case ndkPackage: p = new PackageImpl(container.size(), this); break; case ndkPackageDeclaration: p = new PackageDeclarationImpl(container.size(), this); break; case ndkParameter: p = new ParameterImpl(container.size(), this); break; case ndkStaticInitializerBlock: p = new StaticInitializerBlockImpl(container.size(), this); break; case ndkTypeParameter: p = new TypeParameterImpl(container.size(), this); break; case ndkVariable: p = new VariableImpl(container.size(), this); break; case ndkIntersectionType: p = new IntersectionTypeImpl(container.size(), this); break; case ndkModuleType: p = new ModuleTypeImpl(container.size(), this); break; default: throw new JavaException(logger.formatMessage("ex.java.Factory.Invalid_kind", ndk ) ); } container.add(p); if (filter.size() < container.size()) filter.resize(); return p; } /** * Creates a new node, insert it into the container and return with it. * @param ndk The kind of the node. * @param id The id of the new node. * @throws JavaException If an invalid (or an abstract) NodeKind is given, JavaException is thrown. * @return Reference to the new node. */ private Base createNode(NodeKind ndk, int id) { Base p = null; switch (ndk) { case ndkBlockComment: p = new BlockCommentImpl(id, this); break; case ndkJavadocComment: p = new JavadocCommentImpl(id, this); break; case ndkLineComment: p = new LineCommentImpl(id, this); break; case ndkAnnotatedTypeExpression: p = new AnnotatedTypeExpressionImpl(id, this); break; case ndkArrayAccess: p = new ArrayAccessImpl(id, this); break; case ndkArrayTypeExpression: p = new ArrayTypeExpressionImpl(id, this); break; case ndkAssignment: p = new AssignmentImpl(id, this); break; case ndkBooleanLiteral: p = new BooleanLiteralImpl(id, this); break; case ndkCharacterLiteral: p = new CharacterLiteralImpl(id, this); break; case ndkClassLiteral: p = new ClassLiteralImpl(id, this); break; case ndkConditional: p = new ConditionalImpl(id, this); break; case ndkDoubleLiteral: p = new DoubleLiteralImpl(id, this); break; case ndkErroneous: p = new ErroneousImpl(id, this); break; case ndkErroneousTypeExpression: p = new ErroneousTypeExpressionImpl(id, this); break; case ndkExternalTypeExpression: p = new ExternalTypeExpressionImpl(id, this); break; case ndkFieldAccess: p = new FieldAccessImpl(id, this); break; case ndkFloatLiteral: p = new FloatLiteralImpl(id, this); break; case ndkIdentifier: p = new IdentifierImpl(id, this); break; case ndkInfixExpression: p = new InfixExpressionImpl(id, this); break; case ndkInstanceOf: p = new InstanceOfImpl(id, this); break; case ndkIntegerLiteral: p = new IntegerLiteralImpl(id, this); break; case ndkLambda: p = new LambdaImpl(id, this); break; case ndkLongLiteral: p = new LongLiteralImpl(id, this); break; case ndkMarkerAnnotation: p = new MarkerAnnotationImpl(id, this); break; case ndkMemberReference: p = new MemberReferenceImpl(id, this); break; case ndkMethodInvocation: p = new MethodInvocationImpl(id, this); break; case ndkNewArray: p = new NewArrayImpl(id, this); break; case ndkNewClass: p = new NewClassImpl(id, this); break; case ndkNormalAnnotation: p = new NormalAnnotationImpl(id, this); break; case ndkNullLiteral: p = new NullLiteralImpl(id, this); break; case ndkParenthesizedExpression: p = new ParenthesizedExpressionImpl(id, this); break; case ndkPostfixExpression: p = new PostfixExpressionImpl(id, this); break; case ndkPrefixExpression: p = new PrefixExpressionImpl(id, this); break; case ndkPrimitiveTypeExpression: p = new PrimitiveTypeExpressionImpl(id, this); break; case ndkQualifiedTypeExpression: p = new QualifiedTypeExpressionImpl(id, this); break; case ndkSimpleTypeExpression: p = new SimpleTypeExpressionImpl(id, this); break; case ndkSingleElementAnnotation: p = new SingleElementAnnotationImpl(id, this); break; case ndkStringLiteral: p = new StringLiteralImpl(id, this); break; case ndkSuper: p = new SuperImpl(id, this); break; case ndkThis: p = new ThisImpl(id, this); break; case ndkTypeApplyExpression: p = new TypeApplyExpressionImpl(id, this); break; case ndkTypeCast: p = new TypeCastImpl(id, this); break; case ndkTypeIntersectionExpression: p = new TypeIntersectionExpressionImpl(id, this); break; case ndkTypeUnionExpression: p = new TypeUnionExpressionImpl(id, this); break; case ndkWildcardExpression: p = new WildcardExpressionImpl(id, this); break; case ndkExports: p = new ExportsImpl(id, this); break; case ndkOpens: p = new OpensImpl(id, this); break; case ndkProvides: p = new ProvidesImpl(id, this); break; case ndkRequires: p = new RequiresImpl(id, this); break; case ndkUses: p = new UsesImpl(id, this); break; case ndkAssert: p = new AssertImpl(id, this); break; case ndkBasicFor: p = new BasicForImpl(id, this); break; case ndkBlock: p = new BlockImpl(id, this); break; case ndkBreak: p = new BreakImpl(id, this); break; case ndkCase: p = new CaseImpl(id, this); break; case ndkContinue: p = new ContinueImpl(id, this); break; case ndkDefault: p = new DefaultImpl(id, this); break; case ndkDo: p = new DoImpl(id, this); break; case ndkEmpty: p = new EmptyImpl(id, this); break; case ndkEnhancedFor: p = new EnhancedForImpl(id, this); break; case ndkExpressionStatement: p = new ExpressionStatementImpl(id, this); break; case ndkHandler: p = new HandlerImpl(id, this); break; case ndkIf: p = new IfImpl(id, this); break; case ndkLabeledStatement: p = new LabeledStatementImpl(id, this); break; case ndkReturn: p = new ReturnImpl(id, this); break; case ndkSwitch: p = new SwitchImpl(id, this); break; case ndkSynchronized: p = new SynchronizedImpl(id, this); break; case ndkThrow: p = new ThrowImpl(id, this); break; case ndkTry: p = new TryImpl(id, this); break; case ndkWhile: p = new WhileImpl(id, this); break; case ndkAnnotationType: p = new AnnotationTypeImpl(id, this); break; case ndkAnnotationTypeElement: p = new AnnotationTypeElementImpl(id, this); break; case ndkAnonymousClass: p = new AnonymousClassImpl(id, this); break; case ndkClass: p = new ClassImpl(id, this); break; case ndkClassGeneric: p = new ClassGenericImpl(id, this); break; case ndkCompilationUnit: p = new CompilationUnitImpl(id, this); break; case ndkEnum: p = new EnumImpl(id, this); break; case ndkEnumConstant: p = new EnumConstantImpl(id, this); break; case ndkImport: p = new ImportImpl(id, this); break; case ndkInstanceInitializerBlock: p = new InstanceInitializerBlockImpl(id, this); break; case ndkInterface: p = new InterfaceImpl(id, this); break; case ndkInterfaceGeneric: p = new InterfaceGenericImpl(id, this); break; case ndkMethod: p = new MethodImpl(id, this); break; case ndkMethodGeneric: p = new MethodGenericImpl(id, this); break; case ndkModule: p = new ModuleImpl(id, this); break; case ndkModuleDeclaration: p = new ModuleDeclarationImpl(id, this); break; case ndkPackage: p = new PackageImpl(id, this); break; case ndkPackageDeclaration: p = new PackageDeclarationImpl(id, this); break; case ndkParameter: p = new ParameterImpl(id, this); break; case ndkStaticInitializerBlock: p = new StaticInitializerBlockImpl(id, this); break; case ndkTypeParameter: p = new TypeParameterImpl(id, this); break; case ndkVariable: p = new VariableImpl(id, this); break; case ndkArrayType: p = new ArrayTypeImpl(id, this); break; case ndkBooleanType: p = new BooleanTypeImpl(id, this); break; case ndkByteType: p = new ByteTypeImpl(id, this); break; case ndkCharType: p = new CharTypeImpl(id, this); break; case ndkClassType: p = new ClassTypeImpl(id, this); break; case ndkDoubleType: p = new DoubleTypeImpl(id, this); break; case ndkErrorType: p = new ErrorTypeImpl(id, this); break; case ndkFloatType: p = new FloatTypeImpl(id, this); break; case ndkIntType: p = new IntTypeImpl(id, this); break; case ndkIntersectionType: p = new IntersectionTypeImpl(id, this); break; case ndkLongType: p = new LongTypeImpl(id, this); break; case ndkLowerBoundedWildcardType: p = new LowerBoundedWildcardTypeImpl(id, this); break; case ndkMethodType: p = new MethodTypeImpl(id, this); break; case ndkModuleType: p = new ModuleTypeImpl(id, this); break; case ndkNoType: p = new NoTypeImpl(id, this); break; case ndkNullType: p = new NullTypeImpl(id, this); break; case ndkPackageType: p = new PackageTypeImpl(id, this); break; case ndkParameterizedType: p = new ParameterizedTypeImpl(id, this); break; case ndkShortType: p = new ShortTypeImpl(id, this); break; case ndkTypeVariable: p = new TypeVariableImpl(id, this); break; case ndkUnboundedWildcardType: p = new UnboundedWildcardTypeImpl(id, this); break; case ndkUnionType: p = new UnionTypeImpl(id, this); break; case ndkUpperBoundedWildcardType: p = new UpperBoundedWildcardTypeImpl(id, this); break; case ndkVoidType: p = new VoidTypeImpl(id, this); break; default: throw new JavaException(logger.formatMessage( "ex.java.Factory.Invalid_kind", ndk ) ); } if (container.size() < id) container.addAll(Collections.<Base>nCopies(id - container.size(), null)); if (container.size() == id) container.add(p); else container.set(id, p); if (filter.size() < container.size()) filter.resize(); return p; } /** * Stores Range data in a ByteArray. */ private void storeRangeData(ByteArray ba, Range range) { ba.append(strTable.set(range.getPath())); ba.append(range.getLine()); ba.append(range.getCol()); ba.append(range.getEndLine()); ba.append(range.getEndCol()); ba.append(range.getWideLine()); ba.append(range.getWideCol()); ba.append(range.getWideEndLine()); ba.append(range.getWideEndCol()); } /** * Creates a new {@link columbus.java.asg.base.BlockComment BlockComment} node, insert it into the container and return with it. * @return Reference to the new node. */ public BlockComment createBlockComment(Range PositionedWithoutComment_position, String Comment_text) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkBlockComment.ordinal()); storeRangeData(ba, PositionedWithoutComment_position); ba.append(strTable.set(Comment_text)); Base b = apspecNodes.get(ba); if (b != null) { return (BlockComment)b; } BlockComment node = (BlockComment)createNode(NodeKind.ndkBlockComment, container.size()); node.setPosition(PositionedWithoutComment_position); node.setText(Comment_text); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.base.JavadocComment JavadocComment} node, insert it into the container and return with it. * @return Reference to the new node. */ public JavadocComment createJavadocComment(Range PositionedWithoutComment_position, String Comment_text) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkJavadocComment.ordinal()); storeRangeData(ba, PositionedWithoutComment_position); ba.append(strTable.set(Comment_text)); Base b = apspecNodes.get(ba); if (b != null) { return (JavadocComment)b; } JavadocComment node = (JavadocComment)createNode(NodeKind.ndkJavadocComment, container.size()); node.setPosition(PositionedWithoutComment_position); node.setText(Comment_text); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.base.LineComment LineComment} node, insert it into the container and return with it. * @return Reference to the new node. */ public LineComment createLineComment(Range PositionedWithoutComment_position, String Comment_text) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkLineComment.ordinal()); storeRangeData(ba, PositionedWithoutComment_position); ba.append(strTable.set(Comment_text)); Base b = apspecNodes.get(ba); if (b != null) { return (LineComment)b; } LineComment node = (LineComment)createNode(NodeKind.ndkLineComment, container.size()); node.setPosition(PositionedWithoutComment_position); node.setText(Comment_text); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.ArrayType ArrayType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ArrayType createArrayType(int ArrayType_size, int ArrayType_componentType) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkArrayType.ordinal()); ba.append(ArrayType_size); ba.append(ArrayType_componentType); Base b = apspecNodes.get(ba); if (b != null) { return (ArrayType)b; } ArrayType node = (ArrayType)createNode(NodeKind.ndkArrayType, container.size()); node.setSize(ArrayType_size); if (ArrayType_componentType != 0) node.setComponentType(ArrayType_componentType); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.BooleanType BooleanType} node, insert it into the container and return with it. * @return Reference to the new node. */ public BooleanType createBooleanType() { if (apspecNodeBooleanType == null) { apspecNodeBooleanType = (BooleanType)createNode(NodeKind.ndkBooleanType, container.size()); } return apspecNodeBooleanType; } /** * Creates a new {@link columbus.java.asg.type.ByteType ByteType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ByteType createByteType() { if (apspecNodeByteType == null) { apspecNodeByteType = (ByteType)createNode(NodeKind.ndkByteType, container.size()); } return apspecNodeByteType; } /** * Creates a new {@link columbus.java.asg.type.CharType CharType} node, insert it into the container and return with it. * @return Reference to the new node. */ public CharType createCharType() { if (apspecNodeCharType == null) { apspecNodeCharType = (CharType)createNode(NodeKind.ndkCharType, container.size()); } return apspecNodeCharType; } /** * Creates a new {@link columbus.java.asg.type.ClassType ClassType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ClassType createClassType(int ScopedType_owner, int ClassType_refersTo) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkClassType.ordinal()); ba.append(ScopedType_owner); ba.append(ClassType_refersTo); Base b = apspecNodes.get(ba); if (b != null) { return (ClassType)b; } ClassType node = (ClassType)createNode(NodeKind.ndkClassType, container.size()); if (ScopedType_owner != 0) node.setOwner(ScopedType_owner); if (ClassType_refersTo != 0) node.setRefersTo(ClassType_refersTo); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.DoubleType DoubleType} node, insert it into the container and return with it. * @return Reference to the new node. */ public DoubleType createDoubleType() { if (apspecNodeDoubleType == null) { apspecNodeDoubleType = (DoubleType)createNode(NodeKind.ndkDoubleType, container.size()); } return apspecNodeDoubleType; } /** * Creates a new {@link columbus.java.asg.type.ErrorType ErrorType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ErrorType createErrorType() { if (apspecNodeErrorType == null) { apspecNodeErrorType = (ErrorType)createNode(NodeKind.ndkErrorType, container.size()); } return apspecNodeErrorType; } /** * Creates a new {@link columbus.java.asg.type.FloatType FloatType} node, insert it into the container and return with it. * @return Reference to the new node. */ public FloatType createFloatType() { if (apspecNodeFloatType == null) { apspecNodeFloatType = (FloatType)createNode(NodeKind.ndkFloatType, container.size()); } return apspecNodeFloatType; } /** * Creates a new {@link columbus.java.asg.type.IntType IntType} node, insert it into the container and return with it. * @return Reference to the new node. */ public IntType createIntType() { if (apspecNodeIntType == null) { apspecNodeIntType = (IntType)createNode(NodeKind.ndkIntType, container.size()); } return apspecNodeIntType; } /** * Creates a new {@link columbus.java.asg.type.LongType LongType} node, insert it into the container and return with it. * @return Reference to the new node. */ public LongType createLongType() { if (apspecNodeLongType == null) { apspecNodeLongType = (LongType)createNode(NodeKind.ndkLongType, container.size()); } return apspecNodeLongType; } /** * Creates a new {@link columbus.java.asg.type.LowerBoundedWildcardType LowerBoundedWildcardType} node, insert it into the container and return with it. * @return Reference to the new node. */ public LowerBoundedWildcardType createLowerBoundedWildcardType(int WildcardType_bound) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkLowerBoundedWildcardType.ordinal()); ba.append(WildcardType_bound); Base b = apspecNodes.get(ba); if (b != null) { return (LowerBoundedWildcardType)b; } LowerBoundedWildcardType node = (LowerBoundedWildcardType)createNode(NodeKind.ndkLowerBoundedWildcardType, container.size()); if (WildcardType_bound != 0) node.setBound(WildcardType_bound); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.MethodType MethodType} node, insert it into the container and return with it. * @return Reference to the new node. */ public MethodType createMethodType(int MethodType_returnType, List<Integer> MethodType_parameterTypes, List<Integer> MethodType_thrownTypes) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkMethodType.ordinal()); ba.append(MethodType_returnType); for (int i : MethodType_parameterTypes) { ba.append(i); } ba.append((byte)0); for (int i : MethodType_thrownTypes) { ba.append(i); } ba.append((byte)0); Base b = apspecNodes.get(ba); if (b != null) { return (MethodType)b; } MethodType node = (MethodType)createNode(NodeKind.ndkMethodType, container.size()); if (MethodType_returnType != 0) node.setReturnType(MethodType_returnType); for (int i : MethodType_parameterTypes) { node.addParameterTypes(i); } for (int i : MethodType_thrownTypes) { node.addThrownTypes(i); } apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.NoType NoType} node, insert it into the container and return with it. * @return Reference to the new node. */ public NoType createNoType() { if (apspecNodeNoType == null) { apspecNodeNoType = (NoType)createNode(NodeKind.ndkNoType, container.size()); } return apspecNodeNoType; } /** * Creates a new {@link columbus.java.asg.type.NullType NullType} node, insert it into the container and return with it. * @return Reference to the new node. */ public NullType createNullType() { if (apspecNodeNullType == null) { apspecNodeNullType = (NullType)createNode(NodeKind.ndkNullType, container.size()); } return apspecNodeNullType; } /** * Creates a new {@link columbus.java.asg.type.PackageType PackageType} node, insert it into the container and return with it. * @return Reference to the new node. */ public PackageType createPackageType(int PackageType_refersTo) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkPackageType.ordinal()); ba.append(PackageType_refersTo); Base b = apspecNodes.get(ba); if (b != null) { return (PackageType)b; } PackageType node = (PackageType)createNode(NodeKind.ndkPackageType, container.size()); if (PackageType_refersTo != 0) node.setRefersTo(PackageType_refersTo); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.ParameterizedType ParameterizedType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ParameterizedType createParameterizedType(int ScopedType_owner, int ParameterizedType_rawType, List<Integer> ParameterizedType_argumentTypes) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkParameterizedType.ordinal()); ba.append(ScopedType_owner); ba.append(ParameterizedType_rawType); for (int i : ParameterizedType_argumentTypes) { ba.append(i); } ba.append((byte)0); Base b = apspecNodes.get(ba); if (b != null) { return (ParameterizedType)b; } ParameterizedType node = (ParameterizedType)createNode(NodeKind.ndkParameterizedType, container.size()); if (ScopedType_owner != 0) node.setOwner(ScopedType_owner); if (ParameterizedType_rawType != 0) node.setRawType(ParameterizedType_rawType); for (int i : ParameterizedType_argumentTypes) { node.addArgumentTypes(i); } apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.ShortType ShortType} node, insert it into the container and return with it. * @return Reference to the new node. */ public ShortType createShortType() { if (apspecNodeShortType == null) { apspecNodeShortType = (ShortType)createNode(NodeKind.ndkShortType, container.size()); } return apspecNodeShortType; } /** * Creates a new {@link columbus.java.asg.type.TypeVariable TypeVariable} node, insert it into the container and return with it. * @return Reference to the new node. */ public TypeVariable createTypeVariable(int TypeVariable_refersTo) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkTypeVariable.ordinal()); ba.append(TypeVariable_refersTo); Base b = apspecNodes.get(ba); if (b != null) { return (TypeVariable)b; } TypeVariable node = (TypeVariable)createNode(NodeKind.ndkTypeVariable, container.size()); if (TypeVariable_refersTo != 0) node.setRefersTo(TypeVariable_refersTo); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.UnboundedWildcardType UnboundedWildcardType} node, insert it into the container and return with it. * @return Reference to the new node. */ public UnboundedWildcardType createUnboundedWildcardType(int WildcardType_bound) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkUnboundedWildcardType.ordinal()); ba.append(WildcardType_bound); Base b = apspecNodes.get(ba); if (b != null) { return (UnboundedWildcardType)b; } UnboundedWildcardType node = (UnboundedWildcardType)createNode(NodeKind.ndkUnboundedWildcardType, container.size()); if (WildcardType_bound != 0) node.setBound(WildcardType_bound); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.UnionType UnionType} node, insert it into the container and return with it. * @return Reference to the new node. */ public UnionType createUnionType(List<Integer> UnionType_alternatives) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkUnionType.ordinal()); for (int i : UnionType_alternatives) { ba.append(i); } ba.append((byte)0); Base b = apspecNodes.get(ba); if (b != null) { return (UnionType)b; } UnionType node = (UnionType)createNode(NodeKind.ndkUnionType, container.size()); for (int i : UnionType_alternatives) { node.addAlternatives(i); } apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.UpperBoundedWildcardType UpperBoundedWildcardType} node, insert it into the container and return with it. * @return Reference to the new node. */ public UpperBoundedWildcardType createUpperBoundedWildcardType(int WildcardType_bound) { ByteArray ba = new ByteArray(); ba.append(NodeKind.ndkUpperBoundedWildcardType.ordinal()); ba.append(WildcardType_bound); Base b = apspecNodes.get(ba); if (b != null) { return (UpperBoundedWildcardType)b; } UpperBoundedWildcardType node = (UpperBoundedWildcardType)createNode(NodeKind.ndkUpperBoundedWildcardType, container.size()); if (WildcardType_bound != 0) node.setBound(WildcardType_bound); apspecNodes.put(ba, node); return node; } /** * Creates a new {@link columbus.java.asg.type.VoidType VoidType} node, insert it into the container and return with it. * @return Reference to the new node. */ public VoidType createVoidType() { if (apspecNodeVoidType == null) { apspecNodeVoidType = (VoidType)createNode(NodeKind.ndkVoidType, container.size()); } return apspecNodeVoidType; } private Base createSimpleAPSpecNodeSafely(NodeKind ndk, int id) { Base node = container.get(id); if (node != null) { if (node.getNodeKind() != ndk) { throw new JavaException(logger.formatMessage("ex.java.Factory.Wrong_node_kind", id, node.getNodeKind(), ndk)); } } else { node = createNode(ndk, id); } return node; } private void init() { int id = 10; apspecNodeVoidType = (VoidType)createSimpleAPSpecNodeSafely(NodeKind.ndkVoidType, id++); apspecNodeBooleanType = (BooleanType)createSimpleAPSpecNodeSafely(NodeKind.ndkBooleanType, id++); apspecNodeCharType = (CharType)createSimpleAPSpecNodeSafely(NodeKind.ndkCharType, id++); apspecNodeByteType = (ByteType)createSimpleAPSpecNodeSafely(NodeKind.ndkByteType, id++); apspecNodeShortType = (ShortType)createSimpleAPSpecNodeSafely(NodeKind.ndkShortType, id++); apspecNodeIntType = (IntType)createSimpleAPSpecNodeSafely(NodeKind.ndkIntType, id++); apspecNodeLongType = (LongType)createSimpleAPSpecNodeSafely(NodeKind.ndkLongType, id++); apspecNodeFloatType = (FloatType)createSimpleAPSpecNodeSafely(NodeKind.ndkFloatType, id++); apspecNodeDoubleType = (DoubleType)createSimpleAPSpecNodeSafely(NodeKind.ndkDoubleType, id++); apspecNodeNullType = (NullType)createSimpleAPSpecNodeSafely(NodeKind.ndkNullType, id++); apspecNodeNoType = (NoType)createSimpleAPSpecNodeSafely(NodeKind.ndkNoType, id++); apspecNodeErrorType = (ErrorType)createSimpleAPSpecNodeSafely(NodeKind.ndkErrorType, id++); } }
52,769
38.856495
153
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/Filter.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import columbus.IO; import columbus.IO.IOMode; import columbus.java.asg.algorithms.AlgorithmPreorder; import columbus.java.asg.visitors.VisitorFilter; import columbus.logger.LoggerHandler; /** * Provides filtering mechanism. */ public class Filter { private static final LoggerHandler logger = new LoggerHandler(Filter.class, Constant.LoggerPropertyFile); /** Reference to the factory. */ private Factory factory; /** Contains the states of the nodes. */ private boolean[] container; /** Real size of the container array. */ private int realSize; /** * Constructor. * @param factory Reference to the Factory. */ public Filter(Factory factory) { this.factory = factory; realSize = factory.size(); container = new boolean[realSize]; } /** * Initializes the Filter. */ public void initializeFilter() { if (realSize == factory.size()) { for (int i = 0; i < realSize; i++) container[i] = false; } else { realSize = factory.size(); container = new boolean[realSize]; } } /** * Gives back the size of the Filter. * @return The size of the Filter. */ public int size() { return realSize; } /** * Resizes the Filter to match the size of the Factory. */ public void resize() { realSize = factory.size(); if (container.length >= realSize) return; int oldCapacity = container.length; int newCapacity = (oldCapacity * 3) / 2 + 1; if (newCapacity < realSize) newCapacity = realSize; boolean[] oldData = container; container = new boolean[newCapacity]; System.arraycopy(oldData, 0, container, 0, oldCapacity); } /** * Tells whether the node is filtered or not. * @param id The id of the node. * @throws JavaException Throws JavaException if the id is too large (larger than the size of the Filter). * @return Returns true if the node with the given id is filtered. */ public boolean getIsFiltered(int id) { if (realSize <= id) throw new JavaException(logger.formatMessage("ex.java.Filter.Invalid_id", id)); return container[id]; } /** * Filters out the given node and all of its descendants. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setFiltered(int id) { if (Common.getIsValid(id)) { VisitorFilter v = new VisitorFilter(); AlgorithmPreorder ap = new AlgorithmPreorder(); ap.setVisitSpecialNodes(false, false); ap.run(factory, v, id); } } /** * Sets the state of the node, all of its descendants and all of its ancestors to not filtered. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setNotFiltered(int id) { // TODO throw new JavaException(logger.formatMessage("ex.java.Factory.This_method_is_not_yet_supported")); } /** * Filter out only the given node (without its children). * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setFilteredThisNodeOnly(int id) { if (realSize <= id) throw new JavaException(logger.formatMessage("ex.java.Filter.Invalid_id", id)); // do not let filter the root node if (id == factory.getRoot().getId()) return; container[id] = true; } /** * Sets the state of the given node (without its children) to not filtered. * @param id The id of the node. * @throws JavaException Throws JavaException id the id is too large (larger than the size of the Filter). */ public void setNotFilteredThisNodeOnly(int id) { if (realSize <= id) throw new JavaException(logger.formatMessage("ex.java.Filter.Invalid_id", id)); container[id] = false; } /** * Saves the filter. * @param filename Then name of the filter file. */ public void save(String filename) { IO io = new IO(filename, IOMode.WRITE); io.writeInt4(realSize); for (int i = 0; i < realSize; i++) io.writeByte1(container[i] ? 0 : (byte)1); io.close(); } /** * Loads the filter. * @param filename Then name of the filter file. */ public void load(String filename) { IO io = new IO(filename, IOMode.READ); realSize = io.readInt4(); container = new boolean[realSize]; for (int i = 0; i < realSize; i++) container[i] = io.readByte1() == 0 ? true : false; io.close(); } }
5,219
27.52459
107
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/EdgeIterator.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; /** * Iterator interface, which can be used to iterate through the edges of the nodes. * @param <T> The base type of the nodes in this edge. */ public interface EdgeIterator<T> { /** * Returns true if this list iterator has more elements when traversing the list in the forward direction. * @return Returns true if the list iterator has more elements when traversing the list in the forward direction. */ boolean hasNext(); /** * Returns the next element in the list. * @return Returns the next element in the list. */ T next(); }
1,313
29.55814
114
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/Common.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg; import columbus.java.asg.base.Base; import columbus.java.asg.enums.NodeKind; import static columbus.java.asg.enums.NodeKind.*; /** * Common contains general graph algorithms and common methods. */ public class Common { /** * Decides whether the node is {@link columbus.java.asg.base.BlockComment BlockComment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.BlockComment BlockComment}. */ public static boolean getIsBlockComment(Base node) { return node instanceof columbus.java.asg.base.BlockComment; } /** * Decides whether the node is {@link columbus.java.asg.base.Comment Comment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.Comment Comment}. */ public static boolean getIsComment(Base node) { return node instanceof columbus.java.asg.base.Comment; } /** * Decides whether the node is {@link columbus.java.asg.base.Commentable Commentable} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.Commentable Commentable}. */ public static boolean getIsCommentable(Base node) { return node instanceof columbus.java.asg.base.Commentable; } /** * Decides whether the node is {@link columbus.java.asg.base.JavadocComment JavadocComment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.JavadocComment JavadocComment}. */ public static boolean getIsJavadocComment(Base node) { return node instanceof columbus.java.asg.base.JavadocComment; } /** * Decides whether the node is {@link columbus.java.asg.base.LineComment LineComment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.LineComment LineComment}. */ public static boolean getIsLineComment(Base node) { return node instanceof columbus.java.asg.base.LineComment; } /** * Decides whether the node is {@link columbus.java.asg.base.Named Named} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.Named Named}. */ public static boolean getIsNamed(Base node) { return node instanceof columbus.java.asg.base.Named; } /** * Decides whether the node is {@link columbus.java.asg.base.NonJavadocComment NonJavadocComment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.NonJavadocComment NonJavadocComment}. */ public static boolean getIsNonJavadocComment(Base node) { return node instanceof columbus.java.asg.base.NonJavadocComment; } /** * Decides whether the node is {@link columbus.java.asg.base.Positioned Positioned} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.Positioned Positioned}. */ public static boolean getIsPositioned(Base node) { return node instanceof columbus.java.asg.base.Positioned; } /** * Decides whether the node is {@link columbus.java.asg.base.PositionedWithoutComment PositionedWithoutComment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.base.PositionedWithoutComment PositionedWithoutComment}. */ public static boolean getIsPositionedWithoutComment(Base node) { return node instanceof columbus.java.asg.base.PositionedWithoutComment; } /** * Decides whether the node is {@link columbus.java.asg.expr.AnnotatedTypeExpression AnnotatedTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.AnnotatedTypeExpression AnnotatedTypeExpression}. */ public static boolean getIsAnnotatedTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.AnnotatedTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.Annotation Annotation} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Annotation Annotation}. */ public static boolean getIsAnnotation(Base node) { return node instanceof columbus.java.asg.expr.Annotation; } /** * Decides whether the node is {@link columbus.java.asg.expr.ArrayAccess ArrayAccess} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ArrayAccess ArrayAccess}. */ public static boolean getIsArrayAccess(Base node) { return node instanceof columbus.java.asg.expr.ArrayAccess; } /** * Decides whether the node is {@link columbus.java.asg.expr.ArrayTypeExpression ArrayTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ArrayTypeExpression ArrayTypeExpression}. */ public static boolean getIsArrayTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.ArrayTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.Assignment Assignment} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Assignment Assignment}. */ public static boolean getIsAssignment(Base node) { return node instanceof columbus.java.asg.expr.Assignment; } /** * Decides whether the node is {@link columbus.java.asg.expr.Binary Binary} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Binary Binary}. */ public static boolean getIsBinary(Base node) { return node instanceof columbus.java.asg.expr.Binary; } /** * Decides whether the node is {@link columbus.java.asg.expr.BooleanLiteral BooleanLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.BooleanLiteral BooleanLiteral}. */ public static boolean getIsBooleanLiteral(Base node) { return node instanceof columbus.java.asg.expr.BooleanLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.CharacterLiteral CharacterLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.CharacterLiteral CharacterLiteral}. */ public static boolean getIsCharacterLiteral(Base node) { return node instanceof columbus.java.asg.expr.CharacterLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.ClassLiteral ClassLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ClassLiteral ClassLiteral}. */ public static boolean getIsClassLiteral(Base node) { return node instanceof columbus.java.asg.expr.ClassLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.Conditional Conditional} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Conditional Conditional}. */ public static boolean getIsConditional(Base node) { return node instanceof columbus.java.asg.expr.Conditional; } /** * Decides whether the node is {@link columbus.java.asg.expr.DoubleLiteral DoubleLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.DoubleLiteral DoubleLiteral}. */ public static boolean getIsDoubleLiteral(Base node) { return node instanceof columbus.java.asg.expr.DoubleLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.Erroneous Erroneous} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Erroneous Erroneous}. */ public static boolean getIsErroneous(Base node) { return node instanceof columbus.java.asg.expr.Erroneous; } /** * Decides whether the node is {@link columbus.java.asg.expr.ErroneousTypeExpression ErroneousTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ErroneousTypeExpression ErroneousTypeExpression}. */ public static boolean getIsErroneousTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.ErroneousTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.Expression Expression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Expression Expression}. */ public static boolean getIsExpression(Base node) { return node instanceof columbus.java.asg.expr.Expression; } /** * Decides whether the node is {@link columbus.java.asg.expr.ExternalTypeExpression ExternalTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ExternalTypeExpression ExternalTypeExpression}. */ public static boolean getIsExternalTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.ExternalTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.FieldAccess FieldAccess} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.FieldAccess FieldAccess}. */ public static boolean getIsFieldAccess(Base node) { return node instanceof columbus.java.asg.expr.FieldAccess; } /** * Decides whether the node is {@link columbus.java.asg.expr.FloatLiteral FloatLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.FloatLiteral FloatLiteral}. */ public static boolean getIsFloatLiteral(Base node) { return node instanceof columbus.java.asg.expr.FloatLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.FunctionalExpression FunctionalExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.FunctionalExpression FunctionalExpression}. */ public static boolean getIsFunctionalExpression(Base node) { return node instanceof columbus.java.asg.expr.FunctionalExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.Identifier Identifier} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Identifier Identifier}. */ public static boolean getIsIdentifier(Base node) { return node instanceof columbus.java.asg.expr.Identifier; } /** * Decides whether the node is {@link columbus.java.asg.expr.InfixExpression InfixExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.InfixExpression InfixExpression}. */ public static boolean getIsInfixExpression(Base node) { return node instanceof columbus.java.asg.expr.InfixExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.InstanceOf InstanceOf} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.InstanceOf InstanceOf}. */ public static boolean getIsInstanceOf(Base node) { return node instanceof columbus.java.asg.expr.InstanceOf; } /** * Decides whether the node is {@link columbus.java.asg.expr.IntegerLiteral IntegerLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.IntegerLiteral IntegerLiteral}. */ public static boolean getIsIntegerLiteral(Base node) { return node instanceof columbus.java.asg.expr.IntegerLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.Lambda Lambda} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Lambda Lambda}. */ public static boolean getIsLambda(Base node) { return node instanceof columbus.java.asg.expr.Lambda; } /** * Decides whether the node is {@link columbus.java.asg.expr.Literal Literal} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Literal Literal}. */ public static boolean getIsLiteral(Base node) { return node instanceof columbus.java.asg.expr.Literal; } /** * Decides whether the node is {@link columbus.java.asg.expr.LongLiteral LongLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.LongLiteral LongLiteral}. */ public static boolean getIsLongLiteral(Base node) { return node instanceof columbus.java.asg.expr.LongLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.MarkerAnnotation MarkerAnnotation} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.MarkerAnnotation MarkerAnnotation}. */ public static boolean getIsMarkerAnnotation(Base node) { return node instanceof columbus.java.asg.expr.MarkerAnnotation; } /** * Decides whether the node is {@link columbus.java.asg.expr.MemberReference MemberReference} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.MemberReference MemberReference}. */ public static boolean getIsMemberReference(Base node) { return node instanceof columbus.java.asg.expr.MemberReference; } /** * Decides whether the node is {@link columbus.java.asg.expr.MethodInvocation MethodInvocation} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.MethodInvocation MethodInvocation}. */ public static boolean getIsMethodInvocation(Base node) { return node instanceof columbus.java.asg.expr.MethodInvocation; } /** * Decides whether the node is {@link columbus.java.asg.expr.NewArray NewArray} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.NewArray NewArray}. */ public static boolean getIsNewArray(Base node) { return node instanceof columbus.java.asg.expr.NewArray; } /** * Decides whether the node is {@link columbus.java.asg.expr.NewClass NewClass} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.NewClass NewClass}. */ public static boolean getIsNewClass(Base node) { return node instanceof columbus.java.asg.expr.NewClass; } /** * Decides whether the node is {@link columbus.java.asg.expr.NormalAnnotation NormalAnnotation} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.NormalAnnotation NormalAnnotation}. */ public static boolean getIsNormalAnnotation(Base node) { return node instanceof columbus.java.asg.expr.NormalAnnotation; } /** * Decides whether the node is {@link columbus.java.asg.expr.NullLiteral NullLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.NullLiteral NullLiteral}. */ public static boolean getIsNullLiteral(Base node) { return node instanceof columbus.java.asg.expr.NullLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.NumberLiteral NumberLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.NumberLiteral NumberLiteral}. */ public static boolean getIsNumberLiteral(Base node) { return node instanceof columbus.java.asg.expr.NumberLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.ParenthesizedExpression ParenthesizedExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.ParenthesizedExpression ParenthesizedExpression}. */ public static boolean getIsParenthesizedExpression(Base node) { return node instanceof columbus.java.asg.expr.ParenthesizedExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.PolyExpression PolyExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.PolyExpression PolyExpression}. */ public static boolean getIsPolyExpression(Base node) { return node instanceof columbus.java.asg.expr.PolyExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.PostfixExpression PostfixExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.PostfixExpression PostfixExpression}. */ public static boolean getIsPostfixExpression(Base node) { return node instanceof columbus.java.asg.expr.PostfixExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.PrefixExpression PrefixExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.PrefixExpression PrefixExpression}. */ public static boolean getIsPrefixExpression(Base node) { return node instanceof columbus.java.asg.expr.PrefixExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.PrimitiveTypeExpression PrimitiveTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.PrimitiveTypeExpression PrimitiveTypeExpression}. */ public static boolean getIsPrimitiveTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.PrimitiveTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.QualifiedTypeExpression QualifiedTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.QualifiedTypeExpression QualifiedTypeExpression}. */ public static boolean getIsQualifiedTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.QualifiedTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.SimpleTypeExpression SimpleTypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.SimpleTypeExpression SimpleTypeExpression}. */ public static boolean getIsSimpleTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.SimpleTypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.SingleElementAnnotation SingleElementAnnotation} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.SingleElementAnnotation SingleElementAnnotation}. */ public static boolean getIsSingleElementAnnotation(Base node) { return node instanceof columbus.java.asg.expr.SingleElementAnnotation; } /** * Decides whether the node is {@link columbus.java.asg.expr.StringLiteral StringLiteral} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.StringLiteral StringLiteral}. */ public static boolean getIsStringLiteral(Base node) { return node instanceof columbus.java.asg.expr.StringLiteral; } /** * Decides whether the node is {@link columbus.java.asg.expr.Super Super} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Super Super}. */ public static boolean getIsSuper(Base node) { return node instanceof columbus.java.asg.expr.Super; } /** * Decides whether the node is {@link columbus.java.asg.expr.This This} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.This This}. */ public static boolean getIsThis(Base node) { return node instanceof columbus.java.asg.expr.This; } /** * Decides whether the node is {@link columbus.java.asg.expr.TypeApplyExpression TypeApplyExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.TypeApplyExpression TypeApplyExpression}. */ public static boolean getIsTypeApplyExpression(Base node) { return node instanceof columbus.java.asg.expr.TypeApplyExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.TypeCast TypeCast} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.TypeCast TypeCast}. */ public static boolean getIsTypeCast(Base node) { return node instanceof columbus.java.asg.expr.TypeCast; } /** * Decides whether the node is {@link columbus.java.asg.expr.TypeExpression TypeExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.TypeExpression TypeExpression}. */ public static boolean getIsTypeExpression(Base node) { return node instanceof columbus.java.asg.expr.TypeExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.TypeIntersectionExpression TypeIntersectionExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.TypeIntersectionExpression TypeIntersectionExpression}. */ public static boolean getIsTypeIntersectionExpression(Base node) { return node instanceof columbus.java.asg.expr.TypeIntersectionExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.TypeUnionExpression TypeUnionExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.TypeUnionExpression TypeUnionExpression}. */ public static boolean getIsTypeUnionExpression(Base node) { return node instanceof columbus.java.asg.expr.TypeUnionExpression; } /** * Decides whether the node is {@link columbus.java.asg.expr.Unary Unary} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.Unary Unary}. */ public static boolean getIsUnary(Base node) { return node instanceof columbus.java.asg.expr.Unary; } /** * Decides whether the node is {@link columbus.java.asg.expr.WildcardExpression WildcardExpression} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.expr.WildcardExpression WildcardExpression}. */ public static boolean getIsWildcardExpression(Base node) { return node instanceof columbus.java.asg.expr.WildcardExpression; } /** * Decides whether the node is {@link columbus.java.asg.module.Exports Exports} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.Exports Exports}. */ public static boolean getIsExports(Base node) { return node instanceof columbus.java.asg.module.Exports; } /** * Decides whether the node is {@link columbus.java.asg.module.ModuleDirective ModuleDirective} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.ModuleDirective ModuleDirective}. */ public static boolean getIsModuleDirective(Base node) { return node instanceof columbus.java.asg.module.ModuleDirective; } /** * Decides whether the node is {@link columbus.java.asg.module.Opens Opens} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.Opens Opens}. */ public static boolean getIsOpens(Base node) { return node instanceof columbus.java.asg.module.Opens; } /** * Decides whether the node is {@link columbus.java.asg.module.Provides Provides} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.Provides Provides}. */ public static boolean getIsProvides(Base node) { return node instanceof columbus.java.asg.module.Provides; } /** * Decides whether the node is {@link columbus.java.asg.module.Requires Requires} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.Requires Requires}. */ public static boolean getIsRequires(Base node) { return node instanceof columbus.java.asg.module.Requires; } /** * Decides whether the node is {@link columbus.java.asg.module.Uses Uses} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.module.Uses Uses}. */ public static boolean getIsUses(Base node) { return node instanceof columbus.java.asg.module.Uses; } /** * Decides whether the node is {@link columbus.java.asg.statm.Assert Assert} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Assert Assert}. */ public static boolean getIsAssert(Base node) { return node instanceof columbus.java.asg.statm.Assert; } /** * Decides whether the node is {@link columbus.java.asg.statm.BasicFor BasicFor} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.BasicFor BasicFor}. */ public static boolean getIsBasicFor(Base node) { return node instanceof columbus.java.asg.statm.BasicFor; } /** * Decides whether the node is {@link columbus.java.asg.statm.Block Block} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Block Block}. */ public static boolean getIsBlock(Base node) { return node instanceof columbus.java.asg.statm.Block; } /** * Decides whether the node is {@link columbus.java.asg.statm.Break Break} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Break Break}. */ public static boolean getIsBreak(Base node) { return node instanceof columbus.java.asg.statm.Break; } /** * Decides whether the node is {@link columbus.java.asg.statm.Case Case} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Case Case}. */ public static boolean getIsCase(Base node) { return node instanceof columbus.java.asg.statm.Case; } /** * Decides whether the node is {@link columbus.java.asg.statm.Continue Continue} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Continue Continue}. */ public static boolean getIsContinue(Base node) { return node instanceof columbus.java.asg.statm.Continue; } /** * Decides whether the node is {@link columbus.java.asg.statm.Default Default} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Default Default}. */ public static boolean getIsDefault(Base node) { return node instanceof columbus.java.asg.statm.Default; } /** * Decides whether the node is {@link columbus.java.asg.statm.Do Do} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Do Do}. */ public static boolean getIsDo(Base node) { return node instanceof columbus.java.asg.statm.Do; } /** * Decides whether the node is {@link columbus.java.asg.statm.Empty Empty} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Empty Empty}. */ public static boolean getIsEmpty(Base node) { return node instanceof columbus.java.asg.statm.Empty; } /** * Decides whether the node is {@link columbus.java.asg.statm.EnhancedFor EnhancedFor} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.EnhancedFor EnhancedFor}. */ public static boolean getIsEnhancedFor(Base node) { return node instanceof columbus.java.asg.statm.EnhancedFor; } /** * Decides whether the node is {@link columbus.java.asg.statm.ExpressionStatement ExpressionStatement} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.ExpressionStatement ExpressionStatement}. */ public static boolean getIsExpressionStatement(Base node) { return node instanceof columbus.java.asg.statm.ExpressionStatement; } /** * Decides whether the node is {@link columbus.java.asg.statm.For For} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.For For}. */ public static boolean getIsFor(Base node) { return node instanceof columbus.java.asg.statm.For; } /** * Decides whether the node is {@link columbus.java.asg.statm.Handler Handler} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Handler Handler}. */ public static boolean getIsHandler(Base node) { return node instanceof columbus.java.asg.statm.Handler; } /** * Decides whether the node is {@link columbus.java.asg.statm.If If} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.If If}. */ public static boolean getIsIf(Base node) { return node instanceof columbus.java.asg.statm.If; } /** * Decides whether the node is {@link columbus.java.asg.statm.Iteration Iteration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Iteration Iteration}. */ public static boolean getIsIteration(Base node) { return node instanceof columbus.java.asg.statm.Iteration; } /** * Decides whether the node is {@link columbus.java.asg.statm.Jump Jump} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Jump Jump}. */ public static boolean getIsJump(Base node) { return node instanceof columbus.java.asg.statm.Jump; } /** * Decides whether the node is {@link columbus.java.asg.statm.LabeledStatement LabeledStatement} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.LabeledStatement LabeledStatement}. */ public static boolean getIsLabeledStatement(Base node) { return node instanceof columbus.java.asg.statm.LabeledStatement; } /** * Decides whether the node is {@link columbus.java.asg.statm.Return Return} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Return Return}. */ public static boolean getIsReturn(Base node) { return node instanceof columbus.java.asg.statm.Return; } /** * Decides whether the node is {@link columbus.java.asg.statm.Selection Selection} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Selection Selection}. */ public static boolean getIsSelection(Base node) { return node instanceof columbus.java.asg.statm.Selection; } /** * Decides whether the node is {@link columbus.java.asg.statm.Statement Statement} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Statement Statement}. */ public static boolean getIsStatement(Base node) { return node instanceof columbus.java.asg.statm.Statement; } /** * Decides whether the node is {@link columbus.java.asg.statm.Switch Switch} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Switch Switch}. */ public static boolean getIsSwitch(Base node) { return node instanceof columbus.java.asg.statm.Switch; } /** * Decides whether the node is {@link columbus.java.asg.statm.SwitchLabel SwitchLabel} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.SwitchLabel SwitchLabel}. */ public static boolean getIsSwitchLabel(Base node) { return node instanceof columbus.java.asg.statm.SwitchLabel; } /** * Decides whether the node is {@link columbus.java.asg.statm.Synchronized Synchronized} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Synchronized Synchronized}. */ public static boolean getIsSynchronized(Base node) { return node instanceof columbus.java.asg.statm.Synchronized; } /** * Decides whether the node is {@link columbus.java.asg.statm.Throw Throw} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Throw Throw}. */ public static boolean getIsThrow(Base node) { return node instanceof columbus.java.asg.statm.Throw; } /** * Decides whether the node is {@link columbus.java.asg.statm.Try Try} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.Try Try}. */ public static boolean getIsTry(Base node) { return node instanceof columbus.java.asg.statm.Try; } /** * Decides whether the node is {@link columbus.java.asg.statm.While While} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.statm.While While}. */ public static boolean getIsWhile(Base node) { return node instanceof columbus.java.asg.statm.While; } /** * Decides whether the node is {@link columbus.java.asg.struc.AnnotatedElement AnnotatedElement} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.AnnotatedElement AnnotatedElement}. */ public static boolean getIsAnnotatedElement(Base node) { return node instanceof columbus.java.asg.struc.AnnotatedElement; } /** * Decides whether the node is {@link columbus.java.asg.struc.AnnotationType AnnotationType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.AnnotationType AnnotationType}. */ public static boolean getIsAnnotationType(Base node) { return node instanceof columbus.java.asg.struc.AnnotationType; } /** * Decides whether the node is {@link columbus.java.asg.struc.AnnotationTypeElement AnnotationTypeElement} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.AnnotationTypeElement AnnotationTypeElement}. */ public static boolean getIsAnnotationTypeElement(Base node) { return node instanceof columbus.java.asg.struc.AnnotationTypeElement; } /** * Decides whether the node is {@link columbus.java.asg.struc.AnonymousClass AnonymousClass} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.AnonymousClass AnonymousClass}. */ public static boolean getIsAnonymousClass(Base node) { return node instanceof columbus.java.asg.struc.AnonymousClass; } /** * Decides whether the node is {@link columbus.java.asg.struc.Class Class} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Class Class}. */ public static boolean getIsClass(Base node) { return node instanceof columbus.java.asg.struc.Class; } /** * Decides whether the node is {@link columbus.java.asg.struc.ClassDeclaration ClassDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.ClassDeclaration ClassDeclaration}. */ public static boolean getIsClassDeclaration(Base node) { return node instanceof columbus.java.asg.struc.ClassDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.ClassGeneric ClassGeneric} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.ClassGeneric ClassGeneric}. */ public static boolean getIsClassGeneric(Base node) { return node instanceof columbus.java.asg.struc.ClassGeneric; } /** * Decides whether the node is {@link columbus.java.asg.struc.CompilationUnit CompilationUnit} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.CompilationUnit CompilationUnit}. */ public static boolean getIsCompilationUnit(Base node) { return node instanceof columbus.java.asg.struc.CompilationUnit; } /** * Decides whether the node is {@link columbus.java.asg.struc.Declaration Declaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Declaration Declaration}. */ public static boolean getIsDeclaration(Base node) { return node instanceof columbus.java.asg.struc.Declaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.Enum Enum} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Enum Enum}. */ public static boolean getIsEnum(Base node) { return node instanceof columbus.java.asg.struc.Enum; } /** * Decides whether the node is {@link columbus.java.asg.struc.EnumConstant EnumConstant} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.EnumConstant EnumConstant}. */ public static boolean getIsEnumConstant(Base node) { return node instanceof columbus.java.asg.struc.EnumConstant; } /** * Decides whether the node is {@link columbus.java.asg.struc.GenericDeclaration GenericDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.GenericDeclaration GenericDeclaration}. */ public static boolean getIsGenericDeclaration(Base node) { return node instanceof columbus.java.asg.struc.GenericDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.Import Import} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Import Import}. */ public static boolean getIsImport(Base node) { return node instanceof columbus.java.asg.struc.Import; } /** * Decides whether the node is {@link columbus.java.asg.struc.InitializerBlock InitializerBlock} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.InitializerBlock InitializerBlock}. */ public static boolean getIsInitializerBlock(Base node) { return node instanceof columbus.java.asg.struc.InitializerBlock; } /** * Decides whether the node is {@link columbus.java.asg.struc.InstanceInitializerBlock InstanceInitializerBlock} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.InstanceInitializerBlock InstanceInitializerBlock}. */ public static boolean getIsInstanceInitializerBlock(Base node) { return node instanceof columbus.java.asg.struc.InstanceInitializerBlock; } /** * Decides whether the node is {@link columbus.java.asg.struc.Interface Interface} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Interface Interface}. */ public static boolean getIsInterface(Base node) { return node instanceof columbus.java.asg.struc.Interface; } /** * Decides whether the node is {@link columbus.java.asg.struc.InterfaceDeclaration InterfaceDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.InterfaceDeclaration InterfaceDeclaration}. */ public static boolean getIsInterfaceDeclaration(Base node) { return node instanceof columbus.java.asg.struc.InterfaceDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.InterfaceGeneric InterfaceGeneric} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.InterfaceGeneric InterfaceGeneric}. */ public static boolean getIsInterfaceGeneric(Base node) { return node instanceof columbus.java.asg.struc.InterfaceGeneric; } /** * Decides whether the node is {@link columbus.java.asg.struc.Member Member} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Member Member}. */ public static boolean getIsMember(Base node) { return node instanceof columbus.java.asg.struc.Member; } /** * Decides whether the node is {@link columbus.java.asg.struc.Method Method} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Method Method}. */ public static boolean getIsMethod(Base node) { return node instanceof columbus.java.asg.struc.Method; } /** * Decides whether the node is {@link columbus.java.asg.struc.MethodDeclaration MethodDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.MethodDeclaration MethodDeclaration}. */ public static boolean getIsMethodDeclaration(Base node) { return node instanceof columbus.java.asg.struc.MethodDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.MethodGeneric MethodGeneric} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.MethodGeneric MethodGeneric}. */ public static boolean getIsMethodGeneric(Base node) { return node instanceof columbus.java.asg.struc.MethodGeneric; } /** * Decides whether the node is {@link columbus.java.asg.struc.Module Module} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Module Module}. */ public static boolean getIsModule(Base node) { return node instanceof columbus.java.asg.struc.Module; } /** * Decides whether the node is {@link columbus.java.asg.struc.ModuleDeclaration ModuleDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.ModuleDeclaration ModuleDeclaration}. */ public static boolean getIsModuleDeclaration(Base node) { return node instanceof columbus.java.asg.struc.ModuleDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.NamedDeclaration NamedDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.NamedDeclaration NamedDeclaration}. */ public static boolean getIsNamedDeclaration(Base node) { return node instanceof columbus.java.asg.struc.NamedDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.NormalMethod NormalMethod} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.NormalMethod NormalMethod}. */ public static boolean getIsNormalMethod(Base node) { return node instanceof columbus.java.asg.struc.NormalMethod; } /** * Decides whether the node is {@link columbus.java.asg.struc.Package Package} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Package Package}. */ public static boolean getIsPackage(Base node) { return node instanceof columbus.java.asg.struc.Package; } /** * Decides whether the node is {@link columbus.java.asg.struc.PackageDeclaration PackageDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.PackageDeclaration PackageDeclaration}. */ public static boolean getIsPackageDeclaration(Base node) { return node instanceof columbus.java.asg.struc.PackageDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.Parameter Parameter} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Parameter Parameter}. */ public static boolean getIsParameter(Base node) { return node instanceof columbus.java.asg.struc.Parameter; } /** * Decides whether the node is {@link columbus.java.asg.struc.Scope Scope} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Scope Scope}. */ public static boolean getIsScope(Base node) { return node instanceof columbus.java.asg.struc.Scope; } /** * Decides whether the node is {@link columbus.java.asg.struc.StaticInitializerBlock StaticInitializerBlock} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.StaticInitializerBlock StaticInitializerBlock}. */ public static boolean getIsStaticInitializerBlock(Base node) { return node instanceof columbus.java.asg.struc.StaticInitializerBlock; } /** * Decides whether the node is {@link columbus.java.asg.struc.TypeDeclaration TypeDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.TypeDeclaration TypeDeclaration}. */ public static boolean getIsTypeDeclaration(Base node) { return node instanceof columbus.java.asg.struc.TypeDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.struc.TypeParameter TypeParameter} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.TypeParameter TypeParameter}. */ public static boolean getIsTypeParameter(Base node) { return node instanceof columbus.java.asg.struc.TypeParameter; } /** * Decides whether the node is {@link columbus.java.asg.struc.Variable Variable} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.Variable Variable}. */ public static boolean getIsVariable(Base node) { return node instanceof columbus.java.asg.struc.Variable; } /** * Decides whether the node is {@link columbus.java.asg.struc.VariableDeclaration VariableDeclaration} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.struc.VariableDeclaration VariableDeclaration}. */ public static boolean getIsVariableDeclaration(Base node) { return node instanceof columbus.java.asg.struc.VariableDeclaration; } /** * Decides whether the node is {@link columbus.java.asg.type.ArrayType ArrayType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ArrayType ArrayType}. */ public static boolean getIsArrayType(Base node) { return node instanceof columbus.java.asg.type.ArrayType; } /** * Decides whether the node is {@link columbus.java.asg.type.BooleanType BooleanType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.BooleanType BooleanType}. */ public static boolean getIsBooleanType(Base node) { return node instanceof columbus.java.asg.type.BooleanType; } /** * Decides whether the node is {@link columbus.java.asg.type.BoundedWildcardType BoundedWildcardType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.BoundedWildcardType BoundedWildcardType}. */ public static boolean getIsBoundedWildcardType(Base node) { return node instanceof columbus.java.asg.type.BoundedWildcardType; } /** * Decides whether the node is {@link columbus.java.asg.type.ByteType ByteType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ByteType ByteType}. */ public static boolean getIsByteType(Base node) { return node instanceof columbus.java.asg.type.ByteType; } /** * Decides whether the node is {@link columbus.java.asg.type.CharType CharType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.CharType CharType}. */ public static boolean getIsCharType(Base node) { return node instanceof columbus.java.asg.type.CharType; } /** * Decides whether the node is {@link columbus.java.asg.type.ClassType ClassType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ClassType ClassType}. */ public static boolean getIsClassType(Base node) { return node instanceof columbus.java.asg.type.ClassType; } /** * Decides whether the node is {@link columbus.java.asg.type.DoubleType DoubleType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.DoubleType DoubleType}. */ public static boolean getIsDoubleType(Base node) { return node instanceof columbus.java.asg.type.DoubleType; } /** * Decides whether the node is {@link columbus.java.asg.type.ErrorType ErrorType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ErrorType ErrorType}. */ public static boolean getIsErrorType(Base node) { return node instanceof columbus.java.asg.type.ErrorType; } /** * Decides whether the node is {@link columbus.java.asg.type.FloatType FloatType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.FloatType FloatType}. */ public static boolean getIsFloatType(Base node) { return node instanceof columbus.java.asg.type.FloatType; } /** * Decides whether the node is {@link columbus.java.asg.type.IntType IntType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.IntType IntType}. */ public static boolean getIsIntType(Base node) { return node instanceof columbus.java.asg.type.IntType; } /** * Decides whether the node is {@link columbus.java.asg.type.IntersectionType IntersectionType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.IntersectionType IntersectionType}. */ public static boolean getIsIntersectionType(Base node) { return node instanceof columbus.java.asg.type.IntersectionType; } /** * Decides whether the node is {@link columbus.java.asg.type.LongType LongType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.LongType LongType}. */ public static boolean getIsLongType(Base node) { return node instanceof columbus.java.asg.type.LongType; } /** * Decides whether the node is {@link columbus.java.asg.type.LowerBoundedWildcardType LowerBoundedWildcardType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.LowerBoundedWildcardType LowerBoundedWildcardType}. */ public static boolean getIsLowerBoundedWildcardType(Base node) { return node instanceof columbus.java.asg.type.LowerBoundedWildcardType; } /** * Decides whether the node is {@link columbus.java.asg.type.MethodType MethodType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.MethodType MethodType}. */ public static boolean getIsMethodType(Base node) { return node instanceof columbus.java.asg.type.MethodType; } /** * Decides whether the node is {@link columbus.java.asg.type.ModuleType ModuleType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ModuleType ModuleType}. */ public static boolean getIsModuleType(Base node) { return node instanceof columbus.java.asg.type.ModuleType; } /** * Decides whether the node is {@link columbus.java.asg.type.NoType NoType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.NoType NoType}. */ public static boolean getIsNoType(Base node) { return node instanceof columbus.java.asg.type.NoType; } /** * Decides whether the node is {@link columbus.java.asg.type.NullType NullType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.NullType NullType}. */ public static boolean getIsNullType(Base node) { return node instanceof columbus.java.asg.type.NullType; } /** * Decides whether the node is {@link columbus.java.asg.type.PackageType PackageType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.PackageType PackageType}. */ public static boolean getIsPackageType(Base node) { return node instanceof columbus.java.asg.type.PackageType; } /** * Decides whether the node is {@link columbus.java.asg.type.ParameterizedType ParameterizedType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ParameterizedType ParameterizedType}. */ public static boolean getIsParameterizedType(Base node) { return node instanceof columbus.java.asg.type.ParameterizedType; } /** * Decides whether the node is {@link columbus.java.asg.type.PrimitiveType PrimitiveType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.PrimitiveType PrimitiveType}. */ public static boolean getIsPrimitiveType(Base node) { return node instanceof columbus.java.asg.type.PrimitiveType; } /** * Decides whether the node is {@link columbus.java.asg.type.ScopedType ScopedType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ScopedType ScopedType}. */ public static boolean getIsScopedType(Base node) { return node instanceof columbus.java.asg.type.ScopedType; } /** * Decides whether the node is {@link columbus.java.asg.type.ShortType ShortType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.ShortType ShortType}. */ public static boolean getIsShortType(Base node) { return node instanceof columbus.java.asg.type.ShortType; } /** * Decides whether the node is {@link columbus.java.asg.type.Type Type} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.Type Type}. */ public static boolean getIsType(Base node) { return node instanceof columbus.java.asg.type.Type; } /** * Decides whether the node is {@link columbus.java.asg.type.TypeVariable TypeVariable} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.TypeVariable TypeVariable}. */ public static boolean getIsTypeVariable(Base node) { return node instanceof columbus.java.asg.type.TypeVariable; } /** * Decides whether the node is {@link columbus.java.asg.type.UnboundedWildcardType UnboundedWildcardType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.UnboundedWildcardType UnboundedWildcardType}. */ public static boolean getIsUnboundedWildcardType(Base node) { return node instanceof columbus.java.asg.type.UnboundedWildcardType; } /** * Decides whether the node is {@link columbus.java.asg.type.UnionType UnionType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.UnionType UnionType}. */ public static boolean getIsUnionType(Base node) { return node instanceof columbus.java.asg.type.UnionType; } /** * Decides whether the node is {@link columbus.java.asg.type.UpperBoundedWildcardType UpperBoundedWildcardType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.UpperBoundedWildcardType UpperBoundedWildcardType}. */ public static boolean getIsUpperBoundedWildcardType(Base node) { return node instanceof columbus.java.asg.type.UpperBoundedWildcardType; } /** * Decides whether the node is {@link columbus.java.asg.type.VoidType VoidType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.VoidType VoidType}. */ public static boolean getIsVoidType(Base node) { return node instanceof columbus.java.asg.type.VoidType; } /** * Decides whether the node is {@link columbus.java.asg.type.WildcardType WildcardType} or not. * @param node The node whose kind is examined. * @return Returns true if the node is {@link columbus.java.asg.type.WildcardType WildcardType}. */ public static boolean getIsWildcardType(Base node) { return node instanceof columbus.java.asg.type.WildcardType; } /** * Decides whether the node is AP spec node or not. * @param node The node whose kind is examined. * @return Returns true if the node is AP spec node. */ public static boolean getIsAPSpecNode(Base node) { NodeKind ndk = node.getNodeKind(); return ndk == ndkBlockComment || ndk == ndkJavadocComment || ndk == ndkLineComment || ndk == ndkArrayType || ndk == ndkBooleanType || ndk == ndkByteType || ndk == ndkCharType || ndk == ndkClassType || ndk == ndkDoubleType || ndk == ndkErrorType || ndk == ndkFloatType || ndk == ndkIntType || ndk == ndkLongType || ndk == ndkLowerBoundedWildcardType || ndk == ndkMethodType || ndk == ndkNoType || ndk == ndkNullType || ndk == ndkPackageType || ndk == ndkParameterizedType || ndk == ndkShortType || ndk == ndkTypeVariable || ndk == ndkUnboundedWildcardType || ndk == ndkUnionType || ndk == ndkUpperBoundedWildcardType || ndk == ndkVoidType; } /** * Decides whether the node is composite or not. * @param node The node whose kind is examined. * @return Returns true if the node is composite. */ public static boolean getIsComposite(Base node) { return !getIsNotComposite(node); } /** * Decides whether the node is composite or not. * @param node The node whose kind is examined. * @return Returns true if the node is not composite. */ public static boolean getIsNotComposite(Base node) { NodeKind ndk = node.getNodeKind(); return ndk == ndkIdentifier || ndk == ndkBooleanLiteral || ndk == ndkCharacterLiteral || ndk == ndkNullLiteral || ndk == ndkDoubleLiteral || ndk == ndkFloatLiteral || ndk == ndkIntegerLiteral || ndk == ndkLongLiteral || ndk == ndkStringLiteral || ndk == ndkSuper || ndk == ndkThis || ndk == ndkExternalTypeExpression || ndk == ndkPrimitiveTypeExpression || ndk == ndkSimpleTypeExpression || ndk == ndkEmpty || ndk == ndkBreak || ndk == ndkContinue || ndk == ndkModule || ndk == ndkJavadocComment || ndk == ndkBlockComment || ndk == ndkLineComment || ndk == ndkArrayType || ndk == ndkErrorType || ndk == ndkIntersectionType || ndk == ndkMethodType || ndk == ndkModuleType || ndk == ndkNoType || ndk == ndkNullType || ndk == ndkPackageType || ndk == ndkBooleanType || ndk == ndkByteType || ndk == ndkCharType || ndk == ndkDoubleType || ndk == ndkFloatType || ndk == ndkIntType || ndk == ndkLongType || ndk == ndkShortType || ndk == ndkVoidType || ndk == ndkClassType || ndk == ndkParameterizedType || ndk == ndkTypeVariable || ndk == ndkUnionType || ndk == ndkLowerBoundedWildcardType || ndk == ndkUpperBoundedWildcardType || ndk == ndkUnboundedWildcardType; } /** * Decides whether the 'base' is one of the base kinds (transitive) of 'what'. * @param what The examined node kind. * @param base The base node kind. * @return Returns true if 'base' is a base kind of 'what'. */ public static boolean getIsBaseClassKind(NodeKind what, NodeKind base) { NodeKind type = what; while (type != base) switch (type) { case ndkBase: return false; case ndkBlockComment: type = ndkNonJavadocComment; break; case ndkComment: type = ndkPositionedWithoutComment; break; case ndkCommentable: type = ndkBase; break; case ndkJavadocComment: type = ndkComment; break; case ndkLineComment: type = ndkNonJavadocComment; break; case ndkNamed: type = ndkBase; break; case ndkNonJavadocComment: type = ndkComment; break; case ndkPositioned: return getIsBaseClassKind(ndkCommentable, base) || getIsBaseClassKind(ndkPositionedWithoutComment, base); case ndkPositionedWithoutComment: type = ndkBase; break; case ndkAnnotatedTypeExpression: type = ndkTypeExpression; break; case ndkAnnotation: type = ndkExpression; break; case ndkArrayAccess: type = ndkBinary; break; case ndkArrayTypeExpression: type = ndkTypeExpression; break; case ndkAssignment: type = ndkBinary; break; case ndkBinary: type = ndkExpression; break; case ndkBooleanLiteral: type = ndkLiteral; break; case ndkCharacterLiteral: type = ndkLiteral; break; case ndkClassLiteral: type = ndkLiteral; break; case ndkConditional: type = ndkExpression; break; case ndkDoubleLiteral: type = ndkNumberLiteral; break; case ndkErroneous: type = ndkExpression; break; case ndkErroneousTypeExpression: type = ndkTypeExpression; break; case ndkExpression: type = ndkPositioned; break; case ndkExternalTypeExpression: type = ndkTypeExpression; break; case ndkFieldAccess: type = ndkBinary; break; case ndkFloatLiteral: type = ndkNumberLiteral; break; case ndkFunctionalExpression: type = ndkPolyExpression; break; case ndkIdentifier: type = ndkExpression; break; case ndkInfixExpression: type = ndkBinary; break; case ndkInstanceOf: type = ndkUnary; break; case ndkIntegerLiteral: type = ndkNumberLiteral; break; case ndkLambda: type = ndkFunctionalExpression; break; case ndkLiteral: type = ndkExpression; break; case ndkLongLiteral: type = ndkNumberLiteral; break; case ndkMarkerAnnotation: type = ndkAnnotation; break; case ndkMemberReference: type = ndkFunctionalExpression; break; case ndkMethodInvocation: type = ndkUnary; break; case ndkNewArray: type = ndkExpression; break; case ndkNewClass: type = ndkExpression; break; case ndkNormalAnnotation: type = ndkAnnotation; break; case ndkNullLiteral: type = ndkLiteral; break; case ndkNumberLiteral: type = ndkLiteral; break; case ndkParenthesizedExpression: type = ndkUnary; break; case ndkPolyExpression: type = ndkExpression; break; case ndkPostfixExpression: type = ndkUnary; break; case ndkPrefixExpression: type = ndkUnary; break; case ndkPrimitiveTypeExpression: type = ndkTypeExpression; break; case ndkQualifiedTypeExpression: type = ndkTypeExpression; break; case ndkSimpleTypeExpression: type = ndkTypeExpression; break; case ndkSingleElementAnnotation: type = ndkAnnotation; break; case ndkStringLiteral: type = ndkLiteral; break; case ndkSuper: type = ndkExpression; break; case ndkThis: type = ndkExpression; break; case ndkTypeApplyExpression: type = ndkTypeExpression; break; case ndkTypeCast: type = ndkUnary; break; case ndkTypeExpression: type = ndkExpression; break; case ndkTypeIntersectionExpression: type = ndkTypeExpression; break; case ndkTypeUnionExpression: type = ndkTypeExpression; break; case ndkUnary: type = ndkExpression; break; case ndkWildcardExpression: type = ndkTypeExpression; break; case ndkExports: type = ndkModuleDirective; break; case ndkModuleDirective: type = ndkPositioned; break; case ndkOpens: type = ndkModuleDirective; break; case ndkProvides: type = ndkModuleDirective; break; case ndkRequires: type = ndkModuleDirective; break; case ndkUses: type = ndkModuleDirective; break; case ndkAssert: type = ndkStatement; break; case ndkBasicFor: type = ndkFor; break; case ndkBlock: type = ndkStatement; break; case ndkBreak: type = ndkJump; break; case ndkCase: type = ndkSwitchLabel; break; case ndkContinue: type = ndkJump; break; case ndkDefault: type = ndkSwitchLabel; break; case ndkDo: type = ndkIteration; break; case ndkEmpty: type = ndkStatement; break; case ndkEnhancedFor: type = ndkFor; break; case ndkExpressionStatement: type = ndkStatement; break; case ndkFor: type = ndkIteration; break; case ndkHandler: type = ndkPositioned; break; case ndkIf: type = ndkSelection; break; case ndkIteration: type = ndkStatement; break; case ndkJump: type = ndkStatement; break; case ndkLabeledStatement: type = ndkStatement; break; case ndkReturn: type = ndkStatement; break; case ndkSelection: type = ndkStatement; break; case ndkStatement: type = ndkPositioned; break; case ndkSwitch: type = ndkSelection; break; case ndkSwitchLabel: type = ndkPositioned; break; case ndkSynchronized: type = ndkStatement; break; case ndkThrow: type = ndkStatement; break; case ndkTry: type = ndkStatement; break; case ndkWhile: type = ndkIteration; break; case ndkAnnotatedElement: type = ndkBase; break; case ndkAnnotationType: type = ndkTypeDeclaration; break; case ndkAnnotationTypeElement: type = ndkMethodDeclaration; break; case ndkAnonymousClass: type = ndkClassDeclaration; break; case ndkClass: type = ndkClassDeclaration; break; case ndkClassDeclaration: type = ndkTypeDeclaration; break; case ndkClassGeneric: return getIsBaseClassKind(ndkClassDeclaration, base) || getIsBaseClassKind(ndkGenericDeclaration, base); case ndkCompilationUnit: return getIsBaseClassKind(ndkPositionedWithoutComment, base) || getIsBaseClassKind(ndkCommentable, base); case ndkDeclaration: return getIsBaseClassKind(ndkMember, base) || getIsBaseClassKind(ndkStatement, base); case ndkEnum: type = ndkTypeDeclaration; break; case ndkEnumConstant: type = ndkVariableDeclaration; break; case ndkGenericDeclaration: type = ndkBase; break; case ndkImport: type = ndkPositioned; break; case ndkInitializerBlock: type = ndkDeclaration; break; case ndkInstanceInitializerBlock: type = ndkInitializerBlock; break; case ndkInterface: type = ndkInterfaceDeclaration; break; case ndkInterfaceDeclaration: type = ndkTypeDeclaration; break; case ndkInterfaceGeneric: return getIsBaseClassKind(ndkInterfaceDeclaration, base) || getIsBaseClassKind(ndkGenericDeclaration, base); case ndkMember: return getIsBaseClassKind(ndkCommentable, base) || getIsBaseClassKind(ndkAnnotatedElement, base); case ndkMethod: type = ndkNormalMethod; break; case ndkMethodDeclaration: type = ndkNamedDeclaration; break; case ndkMethodGeneric: return getIsBaseClassKind(ndkNormalMethod, base) || getIsBaseClassKind(ndkGenericDeclaration, base); case ndkModule: type = ndkNamed; break; case ndkModuleDeclaration: type = ndkPositioned; break; case ndkNamedDeclaration: return getIsBaseClassKind(ndkDeclaration, base) || getIsBaseClassKind(ndkNamed, base); case ndkNormalMethod: type = ndkMethodDeclaration; break; case ndkPackage: return getIsBaseClassKind(ndkNamed, base) || getIsBaseClassKind(ndkScope, base); case ndkPackageDeclaration: type = ndkPositioned; break; case ndkParameter: type = ndkVariableDeclaration; break; case ndkScope: type = ndkMember; break; case ndkStaticInitializerBlock: type = ndkInitializerBlock; break; case ndkTypeDeclaration: return getIsBaseClassKind(ndkNamedDeclaration, base) || getIsBaseClassKind(ndkScope, base); case ndkTypeParameter: return getIsBaseClassKind(ndkPositioned, base) || getIsBaseClassKind(ndkNamed, base); case ndkVariable: type = ndkVariableDeclaration; break; case ndkVariableDeclaration: type = ndkNamedDeclaration; break; case ndkArrayType: type = ndkType; break; case ndkBooleanType: type = ndkPrimitiveType; break; case ndkBoundedWildcardType: type = ndkWildcardType; break; case ndkByteType: type = ndkPrimitiveType; break; case ndkCharType: type = ndkPrimitiveType; break; case ndkClassType: type = ndkScopedType; break; case ndkDoubleType: type = ndkPrimitiveType; break; case ndkErrorType: type = ndkType; break; case ndkFloatType: type = ndkPrimitiveType; break; case ndkIntType: type = ndkPrimitiveType; break; case ndkIntersectionType: type = ndkType; break; case ndkLongType: type = ndkPrimitiveType; break; case ndkLowerBoundedWildcardType: type = ndkBoundedWildcardType; break; case ndkMethodType: type = ndkType; break; case ndkModuleType: type = ndkType; break; case ndkNoType: type = ndkType; break; case ndkNullType: type = ndkType; break; case ndkPackageType: type = ndkType; break; case ndkParameterizedType: type = ndkScopedType; break; case ndkPrimitiveType: type = ndkType; break; case ndkScopedType: type = ndkType; break; case ndkShortType: type = ndkPrimitiveType; break; case ndkType: type = ndkBase; break; case ndkTypeVariable: type = ndkType; break; case ndkUnboundedWildcardType: type = ndkWildcardType; break; case ndkUnionType: type = ndkType; break; case ndkUpperBoundedWildcardType: type = ndkBoundedWildcardType; break; case ndkVoidType: type = ndkPrimitiveType; break; case ndkWildcardType: type = ndkType; break; } return true; } /** * Returns true if the node exists and is not filtered out. * @param id The examined node ID. * @return True if the node exists and is not filtered out. */ public static boolean getIsValid(int id) { return id > 1; } }
73,727
35.535183
125
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/FloatLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface FloatLiteral, which represents the {@link columbus.java.asg.expr.FloatLiteral FloatLiteral} node. * @columbus.node (missing) * @columbus.attr floatValue (float) : (missing) */ public interface FloatLiteral extends NumberLiteral { /** * Gives back the {@link columbus.java.asg.expr.FloatLiteral#attributeFloatValue floatValue} of the node. * @return Returns with the floatValue. */ public float getFloatValue(); /** * Sets the {@link columbus.java.asg.expr.FloatLiteral#attributeFloatValue floatValue} of the node. * @param value The new value of the floatValue. */ public void setFloatValue(float value); }
1,412
30.4
110
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Super.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface Super, which represents the {@link columbus.java.asg.expr.Super Super} node. * @columbus.node (missing) */ public interface Super extends Expression { }
939
28.375
89
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/CharacterLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface CharacterLiteral, which represents the {@link columbus.java.asg.expr.CharacterLiteral CharacterLiteral} node. * @columbus.node (missing) * @columbus.attr charValue (char) : (missing) * @columbus.attr formatString (String) : (missing) */ public interface CharacterLiteral extends Literal { /** * Gives back the {@link columbus.java.asg.expr.CharacterLiteral#attributeCharValue charValue} of the node. * @return Returns with the charValue. */ public char getCharValue(); /** * Sets the {@link columbus.java.asg.expr.CharacterLiteral#attributeCharValue charValue} of the node. * @param value The new value of the charValue. */ public void setCharValue(char value); /** * Gives back the {@link columbus.java.asg.expr.CharacterLiteral#attributeFormatString formatString} of the node. * @return Returns with the formatString. */ public String getFormatString(); /** * Gives back the Key of {@link columbus.java.asg.expr.CharacterLiteral#attributeFormatString formatString} of the node. * @return Returns with the Key of the formatString. */ public int getFormatStringKey(); /** * Sets the {@link columbus.java.asg.expr.CharacterLiteral#attributeFormatString formatString} of the node. * @param value The new value of the formatString. */ public void setFormatString(String value); }
2,110
31.984375
122
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Expression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.type.Type; import columbus.java.asg.base.Positioned; /** * Interface Expression, which represents the {@link columbus.java.asg.expr.Expression Expression} node. * @columbus.node (missing) * @columbus.edge type ({@link columbus.java.asg.type.Type Type}, single) : (missing) */ public interface Expression extends Positioned { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Expression#edgeType type} edge points to. * @return Returns the end point of the type edge. */ public Type getType(); /** * Sets the {@link columbus.java.asg.expr.Expression#edgeType type} edge. * @param id The new end point of the type edge. */ public void setType(int id); /** * Sets the {@link columbus.java.asg.expr.Expression#edgeType type} edge. * @param node The new end point of the type edge. */ public void setType(Type node); }
1,664
30.415094
116
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/InstanceOfImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.InstanceOf InstanceOf} node. * <p><b>WARNING: For internal use only.</b></p> */ public class InstanceOfImpl extends BaseImpl implements InstanceOf { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(InstanceOfImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; protected int _hasTypeOperand; public InstanceOfImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkInstanceOf; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } @Override public TypeExpression getTypeOperand() { if (_hasTypeOperand == 0) return null; if (factory.getIsFiltered(_hasTypeOperand)) return null; return (TypeExpression)factory.getRef(_hasTypeOperand); } @Override public void setTypeOperand(int _id) { if (_hasTypeOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasTypeOperand = _id; setParentEdge(_hasTypeOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTypeOperand(TypeExpression _node) { if (_hasTypeOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeOperand" )); _hasTypeOperand = _node.getId(); setParentEdge(_hasTypeOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); io.writeInt4(!factory.getIsFiltered(_hasTypeOperand) ? _hasTypeOperand : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); _hasTypeOperand = io.readInt4(); if (_hasTypeOperand != 0) setParentEdge(_hasTypeOperand); } }
9,139
24.746479
132
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ExternalTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface ExternalTypeExpression, which represents the {@link columbus.java.asg.expr.ExternalTypeExpression ExternalTypeExpression} node. * @columbus.node (missing) */ public interface ExternalTypeExpression extends TypeExpression { }
1,011
30.625
140
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/SuperImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Super Super} node. * <p><b>WARNING: For internal use only.</b></p> */ public class SuperImpl extends BaseImpl implements Super { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(SuperImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; public SuperImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkSuper; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); } }
6,582
23.655431
127
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/AnnotatedTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface AnnotatedTypeExpression, which represents the {@link columbus.java.asg.expr.AnnotatedTypeExpression AnnotatedTypeExpression} node. * @columbus.node (missing) * @columbus.edge hasAnnotations ({@link columbus.java.asg.expr.Annotation Annotation}, multiple) : (missing) * @columbus.edge hasUnderlyingType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface AnnotatedTypeExpression extends TypeExpression { /** * Gives back iterator for the {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasAnnotations hasAnnotations} edges. * @return Returns an iterator for the hasAnnotations edges. */ public EdgeIterator<Annotation> getAnnotationsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasAnnotations hasAnnotations} edges or not. * @return Returns true if the node doesn't have any hasAnnotations edge. */ public boolean getAnnotationsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasAnnotations hasAnnotations} edges the node has. * @return Returns with the number of hasAnnotations edges. */ public int getAnnotationsSize(); /** * Adds a new {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasAnnotations hasAnnotations} edge to the node. * @param id The end point of the new hasAnnotations edge. */ public void addAnnotations(int id); /** * Adds a new {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasAnnotations hasAnnotations} edge to the node. * @param node The end point of the new hasAnnotations edge. */ public void addAnnotations(Annotation node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasUnderlyingType hasUnderlyingType} edge points to. * @return Returns the end point of the hasUnderlyingType edge. */ public TypeExpression getUnderlyingType(); /** * Sets the {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasUnderlyingType hasUnderlyingType} edge. * @param id The new end point of the hasUnderlyingType edge. */ public void setUnderlyingType(int id); /** * Sets the {@link columbus.java.asg.expr.AnnotatedTypeExpression#edgeHasUnderlyingType hasUnderlyingType} edge. * @param node The new end point of the hasUnderlyingType edge. */ public void setUnderlyingType(TypeExpression node); }
3,250
38.168675
155
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ConditionalImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Conditional Conditional} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ConditionalImpl extends BaseImpl implements Conditional { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ConditionalImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected Object colonPosition; protected int _hasCondition; protected int _hasTrueExpression; protected int _hasFalseExpression; public ConditionalImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); colonPosition = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkConditional; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public Range getColonPosition() { return (Range)colonPosition; } @Override public void setColonPosition(Range _colonPosition) { if (factory.getStringTable() == _colonPosition.getStringTable()) colonPosition = _colonPosition; else colonPosition = new Range(factory.getStringTable(), _colonPosition); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getCondition() { if (_hasCondition == 0) return null; if (factory.getIsFiltered(_hasCondition)) return null; return (Expression)factory.getRef(_hasCondition); } @Override public Expression getTrueExpression() { if (_hasTrueExpression == 0) return null; if (factory.getIsFiltered(_hasTrueExpression)) return null; return (Expression)factory.getRef(_hasTrueExpression); } @Override public Expression getFalseExpression() { if (_hasFalseExpression == 0) return null; if (factory.getIsFiltered(_hasFalseExpression)) return null; return (Expression)factory.getRef(_hasFalseExpression); } @Override public void setCondition(int _id) { if (_hasCondition != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasCondition" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasCondition = _id; setParentEdge(_hasCondition); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setCondition(Expression _node) { if (_hasCondition != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasCondition" )); _hasCondition = _node.getId(); setParentEdge(_hasCondition); } @Override public void setTrueExpression(int _id) { if (_hasTrueExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTrueExpression" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasTrueExpression = _id; setParentEdge(_hasTrueExpression); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTrueExpression(Expression _node) { if (_hasTrueExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTrueExpression" )); _hasTrueExpression = _node.getId(); setParentEdge(_hasTrueExpression); } @Override public void setFalseExpression(int _id) { if (_hasFalseExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasFalseExpression" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasFalseExpression = _id; setParentEdge(_hasFalseExpression); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setFalseExpression(Expression _node) { if (_hasFalseExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasFalseExpression" )); _hasFalseExpression = _node.getId(); setParentEdge(_hasFalseExpression); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(((Range)colonPosition).getPathKey()); io.writeInt4(((Range)colonPosition).getLine()); io.writeInt4(((Range)colonPosition).getCol()); io.writeInt4(((Range)colonPosition).getEndLine()); io.writeInt4(((Range)colonPosition).getEndCol()); io.writeInt4(((Range)colonPosition).getWideLine()); io.writeInt4(((Range)colonPosition).getWideCol()); io.writeInt4(((Range)colonPosition).getWideEndLine()); io.writeInt4(((Range)colonPosition).getWideEndCol()); io.writeInt4(!factory.getIsFiltered(_hasCondition) ? _hasCondition : 0); io.writeInt4(!factory.getIsFiltered(_hasTrueExpression) ? _hasTrueExpression : 0); io.writeInt4(!factory.getIsFiltered(_hasFalseExpression) ? _hasFalseExpression : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); ((Range)colonPosition).setPathKey(io.readInt4()); ((Range)colonPosition).setLine(io.readInt4()); ((Range)colonPosition).setCol(io.readInt4()); ((Range)colonPosition).setEndLine(io.readInt4()); ((Range)colonPosition).setEndCol(io.readInt4()); ((Range)colonPosition).setWideLine(io.readInt4()); ((Range)colonPosition).setWideCol(io.readInt4()); ((Range)colonPosition).setWideEndLine(io.readInt4()); ((Range)colonPosition).setWideEndCol(io.readInt4()); _hasCondition = io.readInt4(); if (_hasCondition != 0) setParentEdge(_hasCondition); _hasTrueExpression = io.readInt4(); if (_hasTrueExpression != 0) setParentEdge(_hasTrueExpression); _hasFalseExpression = io.readInt4(); if (_hasFalseExpression != 0) setParentEdge(_hasFalseExpression); } }
11,968
26.642032
133
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Conditional.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface Conditional, which represents the {@link columbus.java.asg.expr.Conditional Conditional} node. * @columbus.node (missing) * @columbus.attr colonPosition (Range) : (missing) * @columbus.edge hasCondition ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) * @columbus.edge hasTrueExpression ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) * @columbus.edge hasFalseExpression ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) */ public interface Conditional extends Expression { /** * Gives back the {@link columbus.java.asg.expr.Conditional#attributeColonPosition colonPosition} of the node. * @return Returns with the colonPosition. */ public Range getColonPosition(); /** * Sets the {@link columbus.java.asg.expr.Conditional#attributeColonPosition colonPosition} of the node. * @param value The new value of the colonPosition. */ public void setColonPosition(Range value); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Conditional#edgeHasCondition hasCondition} edge points to. * @return Returns the end point of the hasCondition edge. */ public Expression getCondition(); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasCondition hasCondition} edge. * @param id The new end point of the hasCondition edge. */ public void setCondition(int id); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasCondition hasCondition} edge. * @param node The new end point of the hasCondition edge. */ public void setCondition(Expression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Conditional#edgeHasTrueExpression hasTrueExpression} edge points to. * @return Returns the end point of the hasTrueExpression edge. */ public Expression getTrueExpression(); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasTrueExpression hasTrueExpression} edge. * @param id The new end point of the hasTrueExpression edge. */ public void setTrueExpression(int id); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasTrueExpression hasTrueExpression} edge. * @param node The new end point of the hasTrueExpression edge. */ public void setTrueExpression(Expression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Conditional#edgeHasFalseExpression hasFalseExpression} edge points to. * @return Returns the end point of the hasFalseExpression edge. */ public Expression getFalseExpression(); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasFalseExpression hasFalseExpression} edge. * @param id The new end point of the hasFalseExpression edge. */ public void setFalseExpression(int id); /** * Sets the {@link columbus.java.asg.expr.Conditional#edgeHasFalseExpression hasFalseExpression} edge. * @param node The new end point of the hasFalseExpression edge. */ public void setFalseExpression(Expression node); }
3,848
36.368932
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MarkerAnnotation.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface MarkerAnnotation, which represents the {@link columbus.java.asg.expr.MarkerAnnotation MarkerAnnotation} node. * @columbus.node (missing) */ public interface MarkerAnnotation extends Annotation { }
983
29.75
122
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/InfixExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.enums.*; /** * Interface InfixExpression, which represents the {@link columbus.java.asg.expr.InfixExpression InfixExpression} node. * @columbus.node (missing) * @columbus.attr operator ({@link columbus.java.asg.enums.InfixOperatorKind InfixOperatorKind}) : (missing) */ public interface InfixExpression extends Binary { /** * Gives back the {@link columbus.java.asg.expr.InfixExpression#attributeOperator operator} of the node. * @return Returns with the operator. */ public InfixOperatorKind getOperator(); /** * Sets the {@link columbus.java.asg.expr.InfixExpression#attributeOperator operator} of the node. * @param value The new value of the operator. */ public void setOperator(InfixOperatorKind value); }
1,525
32.173913
119
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NormalAnnotationImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.NormalAnnotation NormalAnnotation} node. * <p><b>WARNING: For internal use only.</b></p> */ public class NormalAnnotationImpl extends BaseImpl implements NormalAnnotation { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(NormalAnnotationImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasAnnotationName; protected EdgeList<Expression> _hasArguments; public NormalAnnotationImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkNormalAnnotation; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getAnnotationName() { if (_hasAnnotationName == 0) return null; if (factory.getIsFiltered(_hasAnnotationName)) return null; return (TypeExpression)factory.getRef(_hasAnnotationName); } @Override public void setAnnotationName(int _id) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasAnnotationName = _id; setParentEdge(_hasAnnotationName); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setAnnotationName(TypeExpression _node) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); _hasAnnotationName = _node.getId(); setParentEdge(_hasAnnotationName); } @Override public EdgeIterator<Expression> getArgumentsIterator() { if (_hasArguments == null) return EdgeList.<Expression>emptyList().iterator(); else return _hasArguments.iterator(); } @Override public boolean getArgumentsIsEmpty() { if (_hasArguments == null) return true; else return _hasArguments.isEmpty(); } @Override public int getArgumentsSize() { if (_hasArguments == null) return 0; else return _hasArguments.size(); } @Override public void addArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addArguments(Expression _node) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasAnnotationName) ? _hasAnnotationName : 0); if (_hasArguments != null) { EdgeIterator<Expression> it = getArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasAnnotationName = io.readInt4(); if (_hasAnnotationName != 0) setParentEdge(_hasAnnotationName); _id = io.readInt4(); if (_id != 0) { _hasArguments = new EdgeList<Expression>(factory); while (_id != 0) { _hasArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
9,662
24.428947
138
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NullLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface NullLiteral, which represents the {@link columbus.java.asg.expr.NullLiteral NullLiteral} node. * @columbus.node (missing) */ public interface NullLiteral extends Literal { }
960
29.03125
107
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ThisImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.This This} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ThisImpl extends BaseImpl implements This { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ThisImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; public ThisImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkThis; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); } }
6,575
23.629213
126
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MethodInvocation.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.struc.MethodDeclaration; /** * Interface MethodInvocation, which represents the {@link columbus.java.asg.expr.MethodInvocation MethodInvocation} node. * @columbus.node (missing) * @columbus.edge hasTypeArguments ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) * @columbus.edge hasArguments ({@link columbus.java.asg.expr.Expression Expression}, multiple) : (missing) * @columbus.edge invokes ({@link columbus.java.asg.struc.MethodDeclaration MethodDeclaration}, single) : (missing) */ public interface MethodInvocation extends Unary { /** * Gives back iterator for the {@link columbus.java.asg.expr.MethodInvocation#edgeHasTypeArguments hasTypeArguments} edges. * @return Returns an iterator for the hasTypeArguments edges. */ public EdgeIterator<TypeExpression> getTypeArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.MethodInvocation#edgeHasTypeArguments hasTypeArguments} edges or not. * @return Returns true if the node doesn't have any hasTypeArguments edge. */ public boolean getTypeArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.MethodInvocation#edgeHasTypeArguments hasTypeArguments} edges the node has. * @return Returns with the number of hasTypeArguments edges. */ public int getTypeArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.MethodInvocation#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param id The end point of the new hasTypeArguments edge. */ public void addTypeArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.MethodInvocation#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param node The end point of the new hasTypeArguments edge. */ public void addTypeArguments(TypeExpression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.MethodInvocation#edgeHasArguments hasArguments} edges. * @return Returns an iterator for the hasArguments edges. */ public EdgeIterator<Expression> getArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.MethodInvocation#edgeHasArguments hasArguments} edges or not. * @return Returns true if the node doesn't have any hasArguments edge. */ public boolean getArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.MethodInvocation#edgeHasArguments hasArguments} edges the node has. * @return Returns with the number of hasArguments edges. */ public int getArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.MethodInvocation#edgeHasArguments hasArguments} edge to the node. * @param id The end point of the new hasArguments edge. */ public void addArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.MethodInvocation#edgeHasArguments hasArguments} edge to the node. * @param node The end point of the new hasArguments edge. */ public void addArguments(Expression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.MethodInvocation#edgeInvokes invokes} edge points to. * @return Returns the end point of the invokes edge. */ public MethodDeclaration getInvokes(); /** * Sets the {@link columbus.java.asg.expr.MethodInvocation#edgeInvokes invokes} edge. * @param id The new end point of the invokes edge. */ public void setInvokes(int id); /** * Sets the {@link columbus.java.asg.expr.MethodInvocation#edgeInvokes invokes} edge. * @param node The new end point of the invokes edge. */ public void setInvokes(MethodDeclaration node); }
4,421
37.452174
130
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Identifier.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.base.Named; /** * Interface Identifier, which represents the {@link columbus.java.asg.expr.Identifier Identifier} node. * @columbus.node (missing) * @columbus.attr name (String) : (missing) * @columbus.edge refersTo ({@link columbus.java.asg.base.Named Named}, single) : (missing) */ public interface Identifier extends Expression { /** * Gives back the {@link columbus.java.asg.expr.Identifier#attributeName name} of the node. * @return Returns with the name. */ public String getName(); /** * Gives back the Key of {@link columbus.java.asg.expr.Identifier#attributeName name} of the node. * @return Returns with the Key of the name. */ public int getNameKey(); /** * Sets the {@link columbus.java.asg.expr.Identifier#attributeName name} of the node. * @param value The new value of the name. */ public void setName(String value); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Identifier#edgeRefersTo refersTo} edge points to. * @return Returns the end point of the refersTo edge. */ public Named getRefersTo(); /** * Sets the {@link columbus.java.asg.expr.Identifier#edgeRefersTo refersTo} edge. * @param id The new end point of the refersTo edge. */ public void setRefersTo(int id); /** * Sets the {@link columbus.java.asg.expr.Identifier#edgeRefersTo refersTo} edge. * @param node The new end point of the refersTo edge. */ public void setRefersTo(Named node); }
2,249
30.690141
124
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NewClassImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.struc.AnonymousClass; import columbus.java.asg.struc.NormalMethod; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.NewClass NewClass} node. * <p><b>WARNING: For internal use only.</b></p> */ public class NewClassImpl extends BaseImpl implements NewClass { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(NewClassImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasEnclosingExpression; protected EdgeList<TypeExpression> _hasTypeArguments; protected int _hasTypeName; protected EdgeList<Expression> _hasArguments; protected int _hasAnonymousClass; protected int _constructor; public NewClassImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkNewClass; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getEnclosingExpression() { if (_hasEnclosingExpression == 0) return null; if (factory.getIsFiltered(_hasEnclosingExpression)) return null; return (Expression)factory.getRef(_hasEnclosingExpression); } @Override public EdgeIterator<TypeExpression> getTypeArgumentsIterator() { if (_hasTypeArguments == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasTypeArguments.iterator(); } @Override public boolean getTypeArgumentsIsEmpty() { if (_hasTypeArguments == null) return true; else return _hasTypeArguments.isEmpty(); } @Override public int getTypeArgumentsSize() { if (_hasTypeArguments == null) return 0; else return _hasTypeArguments.size(); } @Override public TypeExpression getTypeName() { if (_hasTypeName == 0) return null; if (factory.getIsFiltered(_hasTypeName)) return null; return (TypeExpression)factory.getRef(_hasTypeName); } @Override public EdgeIterator<Expression> getArgumentsIterator() { if (_hasArguments == null) return EdgeList.<Expression>emptyList().iterator(); else return _hasArguments.iterator(); } @Override public boolean getArgumentsIsEmpty() { if (_hasArguments == null) return true; else return _hasArguments.isEmpty(); } @Override public int getArgumentsSize() { if (_hasArguments == null) return 0; else return _hasArguments.size(); } @Override public AnonymousClass getAnonymousClass() { if (_hasAnonymousClass == 0) return null; if (factory.getIsFiltered(_hasAnonymousClass)) return null; return (AnonymousClass)factory.getRef(_hasAnonymousClass); } @Override public NormalMethod getConstructor() { if (_constructor == 0) return null; if (factory.getIsFiltered(_constructor)) return null; return (NormalMethod)factory.getRef(_constructor); } @Override public void setEnclosingExpression(int _id) { if (_hasEnclosingExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasEnclosingExpression" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasEnclosingExpression = _id; setParentEdge(_hasEnclosingExpression); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setEnclosingExpression(Expression _node) { if (_hasEnclosingExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasEnclosingExpression" )); _hasEnclosingExpression = _node.getId(); setParentEdge(_hasEnclosingExpression); } @Override public void addTypeArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addTypeArguments(TypeExpression _node) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_node); setParentEdge(_node); } @Override public void setTypeName(int _id) { if (_hasTypeName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeName" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasTypeName = _id; setParentEdge(_hasTypeName); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTypeName(TypeExpression _node) { if (_hasTypeName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeName" )); _hasTypeName = _node.getId(); setParentEdge(_hasTypeName); } @Override public void addArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addArguments(Expression _node) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_node); setParentEdge(_node); } @Override public void setAnonymousClass(int _id) { if (_hasAnonymousClass != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnonymousClass" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (_node.getNodeKind() == NodeKind.ndkAnonymousClass) { _hasAnonymousClass = _id; setParentEdge(_hasAnonymousClass); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setAnonymousClass(AnonymousClass _node) { if (_hasAnonymousClass != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnonymousClass" )); _hasAnonymousClass = _node.getId(); setParentEdge(_hasAnonymousClass); } @Override public void setConstructor(int _id) { if (_constructor != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","constructor" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkNormalMethod)) { _constructor = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setConstructor(NormalMethod _node) { if (_constructor != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","constructor" )); _constructor = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasEnclosingExpression) ? _hasEnclosingExpression : 0); io.writeInt4(!factory.getIsFiltered(_hasTypeName) ? _hasTypeName : 0); io.writeInt4(!factory.getIsFiltered(_hasAnonymousClass) ? _hasAnonymousClass : 0); io.writeInt4(!factory.getIsFiltered(_constructor) ? _constructor : 0); if (_hasTypeArguments != null) { EdgeIterator<TypeExpression> it = getTypeArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); if (_hasArguments != null) { EdgeIterator<Expression> it = getArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasEnclosingExpression = io.readInt4(); if (_hasEnclosingExpression != 0) setParentEdge(_hasEnclosingExpression); _hasTypeName = io.readInt4(); if (_hasTypeName != 0) setParentEdge(_hasTypeName); _hasAnonymousClass = io.readInt4(); if (_hasAnonymousClass != 0) setParentEdge(_hasAnonymousClass); _constructor = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasTypeArguments = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasTypeArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } _id = io.readInt4(); if (_id != 0) { _hasArguments = new EdgeList<Expression>(factory); while (_id != 0) { _hasArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
15,259
25.53913
130
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ClassLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ClassLiteral ClassLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ClassLiteralImpl extends BaseImpl implements ClassLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ClassLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasComponentType; public ClassLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkClassLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getComponentType() { if (_hasComponentType == 0) return null; if (factory.getIsFiltered(_hasComponentType)) return null; return (TypeExpression)factory.getRef(_hasComponentType); } @Override public void setComponentType(int _id) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasComponentType = _id; setParentEdge(_hasComponentType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setComponentType(TypeExpression _node) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); _hasComponentType = _node.getId(); setParentEdge(_hasComponentType); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasComponentType) ? _hasComponentType : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasComponentType = io.readInt4(); if (_hasComponentType != 0) setParentEdge(_hasComponentType); } }
7,980
24.662379
134
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/InstanceOf.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface InstanceOf, which represents the {@link columbus.java.asg.expr.InstanceOf InstanceOf} node. * @columbus.node (missing) * @columbus.edge hasTypeOperand ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface InstanceOf extends Unary { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.InstanceOf#edgeHasTypeOperand hasTypeOperand} edge points to. * @return Returns the end point of the hasTypeOperand edge. */ public TypeExpression getTypeOperand(); /** * Sets the {@link columbus.java.asg.expr.InstanceOf#edgeHasTypeOperand hasTypeOperand} edge. * @param id The new end point of the hasTypeOperand edge. */ public void setTypeOperand(int id); /** * Sets the {@link columbus.java.asg.expr.InstanceOf#edgeHasTypeOperand hasTypeOperand} edge. * @param node The new end point of the hasTypeOperand edge. */ public void setTypeOperand(TypeExpression node); }
1,742
33.176471
136
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/PrimitiveTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.enums.*; /** * Interface PrimitiveTypeExpression, which represents the {@link columbus.java.asg.expr.PrimitiveTypeExpression PrimitiveTypeExpression} node. * @columbus.node (missing) * @columbus.attr kind ({@link columbus.java.asg.enums.PrimitiveTypeKind PrimitiveTypeKind}) : (missing) */ public interface PrimitiveTypeExpression extends TypeExpression { /** * Gives back the {@link columbus.java.asg.expr.PrimitiveTypeExpression#attributeKind kind} of the node. * @return Returns with the kind. */ public PrimitiveTypeKind getKind(); /** * Sets the {@link columbus.java.asg.expr.PrimitiveTypeExpression#attributeKind kind} of the node. * @param value The new value of the kind. */ public void setKind(PrimitiveTypeKind value); }
1,545
32.608696
143
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/BooleanLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.BooleanLiteral BooleanLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class BooleanLiteralImpl extends BaseImpl implements BooleanLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(BooleanLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected boolean booleanValue; public BooleanLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkBooleanLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public boolean getBooleanValue() { return booleanValue; } @Override public void setBooleanValue(boolean _booleanValue) { booleanValue = _booleanValue; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); { byte boolValues = 0; boolValues <<= 1; if (booleanValue) boolValues |= 1; io.writeByte1(boolValues); } } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); { byte boolValues = io.readByte1(); booleanValue = (boolValues & 1) != 0; boolValues >>>= 1; } } }
7,089
23.280822
136
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Erroneous.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.base.Positioned; /** * Interface Erroneous, which represents the {@link columbus.java.asg.expr.Erroneous Erroneous} node. * @columbus.node (missing) * @columbus.edge hasErrors ({@link columbus.java.asg.base.Positioned Positioned}, multiple) : (missing) */ public interface Erroneous extends Expression { /** * Gives back iterator for the {@link columbus.java.asg.expr.Erroneous#edgeHasErrors hasErrors} edges. * @return Returns an iterator for the hasErrors edges. */ public EdgeIterator<Positioned> getErrorsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.Erroneous#edgeHasErrors hasErrors} edges or not. * @return Returns true if the node doesn't have any hasErrors edge. */ public boolean getErrorsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.Erroneous#edgeHasErrors hasErrors} edges the node has. * @return Returns with the number of hasErrors edges. */ public int getErrorsSize(); /** * Adds a new {@link columbus.java.asg.expr.Erroneous#edgeHasErrors hasErrors} edge to the node. * @param id The end point of the new hasErrors edge. */ public void addErrors(int id); /** * Adds a new {@link columbus.java.asg.expr.Erroneous#edgeHasErrors hasErrors} edge to the node. * @param node The end point of the new hasErrors edge. */ public void addErrors(Positioned node); }
2,191
32.723077
109
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MemberReference.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.struc.MethodDeclaration; import columbus.java.asg.enums.*; /** * Interface MemberReference, which represents the {@link columbus.java.asg.expr.MemberReference MemberReference} node. * @columbus.node (missing) * @columbus.attr name (String) : (missing) * @columbus.attr mode ({@link columbus.java.asg.enums.MemberReferenceModeKind MemberReferenceModeKind}) : (missing) * @columbus.attr referenceKind ({@link columbus.java.asg.enums.MemberReferenceKind MemberReferenceKind}) : (missing) * @columbus.attr overloadKind ({@link columbus.java.asg.enums.MemberReferenceOverloadKind MemberReferenceOverloadKind}) : (missing) * @columbus.edge hasQualifierExpression ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) * @columbus.edge hasTypeArguments ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) * @columbus.edge referredMethod ({@link columbus.java.asg.struc.MethodDeclaration MethodDeclaration}, single) : (missing) */ public interface MemberReference extends FunctionalExpression { /** * Gives back the {@link columbus.java.asg.expr.MemberReference#attributeName name} of the node. * @return Returns with the name. */ public String getName(); /** * Gives back the Key of {@link columbus.java.asg.expr.MemberReference#attributeName name} of the node. * @return Returns with the Key of the name. */ public int getNameKey(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#attributeName name} of the node. * @param value The new value of the name. */ public void setName(String value); /** * Gives back the {@link columbus.java.asg.expr.MemberReference#attributeMode mode} of the node. * @return Returns with the mode. */ public MemberReferenceModeKind getMode(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#attributeMode mode} of the node. * @param value The new value of the mode. */ public void setMode(MemberReferenceModeKind value); /** * Gives back the {@link columbus.java.asg.expr.MemberReference#attributeReferenceKind referenceKind} of the node. * @return Returns with the referenceKind. */ public MemberReferenceKind getReferenceKind(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#attributeReferenceKind referenceKind} of the node. * @param value The new value of the referenceKind. */ public void setReferenceKind(MemberReferenceKind value); /** * Gives back the {@link columbus.java.asg.expr.MemberReference#attributeOverloadKind overloadKind} of the node. * @return Returns with the overloadKind. */ public MemberReferenceOverloadKind getOverloadKind(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#attributeOverloadKind overloadKind} of the node. * @param value The new value of the overloadKind. */ public void setOverloadKind(MemberReferenceOverloadKind value); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.MemberReference#edgeHasQualifierExpression hasQualifierExpression} edge points to. * @return Returns the end point of the hasQualifierExpression edge. */ public Expression getQualifierExpression(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#edgeHasQualifierExpression hasQualifierExpression} edge. * @param id The new end point of the hasQualifierExpression edge. */ public void setQualifierExpression(int id); /** * Sets the {@link columbus.java.asg.expr.MemberReference#edgeHasQualifierExpression hasQualifierExpression} edge. * @param node The new end point of the hasQualifierExpression edge. */ public void setQualifierExpression(Expression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.MemberReference#edgeHasTypeArguments hasTypeArguments} edges. * @return Returns an iterator for the hasTypeArguments edges. */ public EdgeIterator<TypeExpression> getTypeArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.MemberReference#edgeHasTypeArguments hasTypeArguments} edges or not. * @return Returns true if the node doesn't have any hasTypeArguments edge. */ public boolean getTypeArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.MemberReference#edgeHasTypeArguments hasTypeArguments} edges the node has. * @return Returns with the number of hasTypeArguments edges. */ public int getTypeArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.MemberReference#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param id The end point of the new hasTypeArguments edge. */ public void addTypeArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.MemberReference#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param node The end point of the new hasTypeArguments edge. */ public void addTypeArguments(TypeExpression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.MemberReference#edgeReferredMethod referredMethod} edge points to. * @return Returns the end point of the referredMethod edge. */ public MethodDeclaration getReferredMethod(); /** * Sets the {@link columbus.java.asg.expr.MemberReference#edgeReferredMethod referredMethod} edge. * @param id The new end point of the referredMethod edge. */ public void setReferredMethod(int id); /** * Sets the {@link columbus.java.asg.expr.MemberReference#edgeReferredMethod referredMethod} edge. * @param node The new end point of the referredMethod edge. */ public void setReferredMethod(MethodDeclaration node); }
6,426
38.67284
157
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NewArray.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface NewArray, which represents the {@link columbus.java.asg.expr.NewArray NewArray} node. * @columbus.node (missing) * @columbus.attr leftBracePosition (Range) : (missing) * @columbus.edge hasComponentType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) * @columbus.edge hasDimensions ({@link columbus.java.asg.expr.Expression Expression}, multiple) : (missing) * @columbus.edge hasInitializers ({@link columbus.java.asg.expr.Expression Expression}, multiple) : (missing) */ public interface NewArray extends Expression { /** * Gives back the {@link columbus.java.asg.expr.NewArray#attributeLeftBracePosition leftBracePosition} of the node. * @return Returns with the leftBracePosition. */ public Range getLeftBracePosition(); /** * Sets the {@link columbus.java.asg.expr.NewArray#attributeLeftBracePosition leftBracePosition} of the node. * @param value The new value of the leftBracePosition. */ public void setLeftBracePosition(Range value); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.NewArray#edgeHasComponentType hasComponentType} edge points to. * @return Returns the end point of the hasComponentType edge. */ public TypeExpression getComponentType(); /** * Sets the {@link columbus.java.asg.expr.NewArray#edgeHasComponentType hasComponentType} edge. * @param id The new end point of the hasComponentType edge. */ public void setComponentType(int id); /** * Sets the {@link columbus.java.asg.expr.NewArray#edgeHasComponentType hasComponentType} edge. * @param node The new end point of the hasComponentType edge. */ public void setComponentType(TypeExpression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.NewArray#edgeHasDimensions hasDimensions} edges. * @return Returns an iterator for the hasDimensions edges. */ public EdgeIterator<Expression> getDimensionsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.NewArray#edgeHasDimensions hasDimensions} edges or not. * @return Returns true if the node doesn't have any hasDimensions edge. */ public boolean getDimensionsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.NewArray#edgeHasDimensions hasDimensions} edges the node has. * @return Returns with the number of hasDimensions edges. */ public int getDimensionsSize(); /** * Adds a new {@link columbus.java.asg.expr.NewArray#edgeHasDimensions hasDimensions} edge to the node. * @param id The end point of the new hasDimensions edge. */ public void addDimensions(int id); /** * Adds a new {@link columbus.java.asg.expr.NewArray#edgeHasDimensions hasDimensions} edge to the node. * @param node The end point of the new hasDimensions edge. */ public void addDimensions(Expression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.NewArray#edgeHasInitializers hasInitializers} edges. * @return Returns an iterator for the hasInitializers edges. */ public EdgeIterator<Expression> getInitializersIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.NewArray#edgeHasInitializers hasInitializers} edges or not. * @return Returns true if the node doesn't have any hasInitializers edge. */ public boolean getInitializersIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.NewArray#edgeHasInitializers hasInitializers} edges the node has. * @return Returns with the number of hasInitializers edges. */ public int getInitializersSize(); /** * Adds a new {@link columbus.java.asg.expr.NewArray#edgeHasInitializers hasInitializers} edge to the node. * @param id The end point of the new hasInitializers edge. */ public void addInitializers(int id); /** * Adds a new {@link columbus.java.asg.expr.NewArray#edgeHasInitializers hasInitializers} edge to the node. * @param node The end point of the new hasInitializers edge. */ public void addInitializers(Expression node); }
4,816
36.929134
138
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/SimpleTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.SimpleTypeExpression SimpleTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class SimpleTypeExpressionImpl extends BaseImpl implements SimpleTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(SimpleTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int name; public SimpleTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkSimpleTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getName() { return factory.getStringTable().get(name); } @Override public int getNameKey() { return name; } @Override public void setName(String _name) { name = factory.getStringTable().set(_name); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(name); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); name = io.readInt4(); } }
6,999
23.305556
142
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MarkerAnnotationImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.MarkerAnnotation MarkerAnnotation} node. * <p><b>WARNING: For internal use only.</b></p> */ public class MarkerAnnotationImpl extends BaseImpl implements MarkerAnnotation { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(MarkerAnnotationImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasAnnotationName; public MarkerAnnotationImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkMarkerAnnotation; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getAnnotationName() { if (_hasAnnotationName == 0) return null; if (factory.getIsFiltered(_hasAnnotationName)) return null; return (TypeExpression)factory.getRef(_hasAnnotationName); } @Override public void setAnnotationName(int _id) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasAnnotationName = _id; setParentEdge(_hasAnnotationName); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setAnnotationName(TypeExpression _node) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); _hasAnnotationName = _node.getId(); setParentEdge(_hasAnnotationName); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasAnnotationName) ? _hasAnnotationName : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasAnnotationName = io.readInt4(); if (_hasAnnotationName != 0) setParentEdge(_hasAnnotationName); } }
8,028
24.81672
138
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/SimpleTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface SimpleTypeExpression, which represents the {@link columbus.java.asg.expr.SimpleTypeExpression SimpleTypeExpression} node. * @columbus.node (missing) * @columbus.attr name (String) : (missing) */ public interface SimpleTypeExpression extends TypeExpression { /** * Gives back the {@link columbus.java.asg.expr.SimpleTypeExpression#attributeName name} of the node. * @return Returns with the name. */ public String getName(); /** * Gives back the Key of {@link columbus.java.asg.expr.SimpleTypeExpression#attributeName name} of the node. * @return Returns with the Key of the name. */ public int getNameKey(); /** * Sets the {@link columbus.java.asg.expr.SimpleTypeExpression#attributeName name} of the node. * @param value The new value of the name. */ public void setName(String value); }
1,603
30.45098
134
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/SingleElementAnnotationImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.SingleElementAnnotation SingleElementAnnotation} node. * <p><b>WARNING: For internal use only.</b></p> */ public class SingleElementAnnotationImpl extends BaseImpl implements SingleElementAnnotation { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(SingleElementAnnotationImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasAnnotationName; protected int _hasArgument; public SingleElementAnnotationImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkSingleElementAnnotation; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getAnnotationName() { if (_hasAnnotationName == 0) return null; if (factory.getIsFiltered(_hasAnnotationName)) return null; return (TypeExpression)factory.getRef(_hasAnnotationName); } @Override public void setAnnotationName(int _id) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasAnnotationName = _id; setParentEdge(_hasAnnotationName); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setAnnotationName(TypeExpression _node) { if (_hasAnnotationName != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasAnnotationName" )); _hasAnnotationName = _node.getId(); setParentEdge(_hasAnnotationName); } @Override public Expression getArgument() { if (_hasArgument == 0) return null; if (factory.getIsFiltered(_hasArgument)) return null; return (Expression)factory.getRef(_hasArgument); } @Override public void setArgument(int _id) { if (_hasArgument != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasArgument" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasArgument = _id; setParentEdge(_hasArgument); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setArgument(Expression _node) { if (_hasArgument != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasArgument" )); _hasArgument = _node.getId(); setParentEdge(_hasArgument); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasAnnotationName) ? _hasAnnotationName : 0); io.writeInt4(!factory.getIsFiltered(_hasArgument) ? _hasArgument : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasAnnotationName = io.readInt4(); if (_hasAnnotationName != 0) setParentEdge(_hasAnnotationName); _hasArgument = io.readInt4(); if (_hasArgument != 0) setParentEdge(_hasArgument); } }
9,310
25.228169
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MemberReferenceImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.struc.MethodDeclaration; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.MemberReference MemberReference} node. * <p><b>WARNING: For internal use only.</b></p> */ public class MemberReferenceImpl extends BaseImpl implements MemberReference { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(MemberReferenceImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected PolyExpressionKind polyKind = PolyExpressionKind.pekStandalone; protected int _target; protected int name; protected MemberReferenceModeKind mode = MemberReferenceModeKind.mrmkInvoke; protected MemberReferenceKind referenceKind = MemberReferenceKind.mrkSuper; protected MemberReferenceOverloadKind overloadKind = MemberReferenceOverloadKind.mrokOverloaded; protected int _hasQualifierExpression; protected EdgeList<TypeExpression> _hasTypeArguments; protected int _referredMethod; public MemberReferenceImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkMemberReference; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public PolyExpressionKind getPolyKind() { return polyKind; } @Override public void setPolyKind(PolyExpressionKind _polyKind) { polyKind = _polyKind; } @Override public String getName() { return factory.getStringTable().get(name); } @Override public int getNameKey() { return name; } @Override public MemberReferenceModeKind getMode() { return mode; } @Override public MemberReferenceKind getReferenceKind() { return referenceKind; } @Override public MemberReferenceOverloadKind getOverloadKind() { return overloadKind; } @Override public void setName(String _name) { name = factory.getStringTable().set(_name); } @Override public void setMode(MemberReferenceModeKind _mode) { mode = _mode; } @Override public void setReferenceKind(MemberReferenceKind _referenceKind) { referenceKind = _referenceKind; } @Override public void setOverloadKind(MemberReferenceOverloadKind _overloadKind) { overloadKind = _overloadKind; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Type getTarget() { if (_target == 0) return null; if (factory.getIsFiltered(_target)) return null; return (Type)factory.getRef(_target); } @Override public void setTarget(int _id) { if (_target != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","target" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _target = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTarget(Type _node) { if (_target != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","target" )); _target = _node.getId(); } @Override public Expression getQualifierExpression() { if (_hasQualifierExpression == 0) return null; if (factory.getIsFiltered(_hasQualifierExpression)) return null; return (Expression)factory.getRef(_hasQualifierExpression); } @Override public EdgeIterator<TypeExpression> getTypeArgumentsIterator() { if (_hasTypeArguments == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasTypeArguments.iterator(); } @Override public boolean getTypeArgumentsIsEmpty() { if (_hasTypeArguments == null) return true; else return _hasTypeArguments.isEmpty(); } @Override public int getTypeArgumentsSize() { if (_hasTypeArguments == null) return 0; else return _hasTypeArguments.size(); } @Override public MethodDeclaration getReferredMethod() { if (_referredMethod == 0) return null; if (factory.getIsFiltered(_referredMethod)) return null; return (MethodDeclaration)factory.getRef(_referredMethod); } @Override public void setQualifierExpression(int _id) { if (_hasQualifierExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasQualifierExpression" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasQualifierExpression = _id; setParentEdge(_hasQualifierExpression); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setQualifierExpression(Expression _node) { if (_hasQualifierExpression != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasQualifierExpression" )); _hasQualifierExpression = _node.getId(); setParentEdge(_hasQualifierExpression); } @Override public void addTypeArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addTypeArguments(TypeExpression _node) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_node); setParentEdge(_node); } @Override public void setReferredMethod(int _id) { if (_referredMethod != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","referredMethod" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkMethodDeclaration)) { _referredMethod = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setReferredMethod(MethodDeclaration _node) { if (_referredMethod != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","referredMethod" )); _referredMethod = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeUByte1(polyKind.ordinal()); io.writeInt4(!factory.getIsFiltered(_target) ? _target : 0); io.writeInt4(name); io.writeUByte1(mode.ordinal()); io.writeUByte1(referenceKind.ordinal()); io.writeUByte1(overloadKind.ordinal()); io.writeInt4(!factory.getIsFiltered(_hasQualifierExpression) ? _hasQualifierExpression : 0); io.writeInt4(!factory.getIsFiltered(_referredMethod) ? _referredMethod : 0); if (_hasTypeArguments != null) { EdgeIterator<TypeExpression> it = getTypeArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); polyKind = PolyExpressionKind.values()[io.readUByte1()]; _target = io.readInt4(); name = io.readInt4(); mode = MemberReferenceModeKind.values()[io.readUByte1()]; referenceKind = MemberReferenceKind.values()[io.readUByte1()]; overloadKind = MemberReferenceOverloadKind.values()[io.readUByte1()]; _hasQualifierExpression = io.readInt4(); if (_hasQualifierExpression != 0) setParentEdge(_hasQualifierExpression); _referredMethod = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasTypeArguments = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasTypeArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
13,939
24.862709
137
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/PrefixExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.PrefixExpression PrefixExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class PrefixExpressionImpl extends BaseImpl implements PrefixExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(PrefixExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; protected PrefixOperatorKind operator = PrefixOperatorKind.peokIncrement; public PrefixExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkPrefixExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public PrefixOperatorKind getOperator() { return operator; } @Override public void setOperator(PrefixOperatorKind _operator) { operator = _operator; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); io.writeUByte1(operator.ordinal()); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); operator = PrefixOperatorKind.values()[io.readUByte1()]; } }
8,220
24.140673
138
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Lambda.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.struc.Parameter; import columbus.java.asg.base.Positioned; import columbus.java.asg.enums.*; /** * Interface Lambda, which represents the {@link columbus.java.asg.expr.Lambda Lambda} node. * @columbus.node (missing) * @columbus.attr lloc (int) : (missing) * @columbus.attr paramKind ({@link columbus.java.asg.enums.LambdaParameterKind LambdaParameterKind}) : (missing) * @columbus.attr bodyKind ({@link columbus.java.asg.enums.LambdaBodyKind LambdaBodyKind}) : (missing) * @columbus.edge hasParameters ({@link columbus.java.asg.struc.Parameter Parameter}, multiple) : (missing) * @columbus.edge hasBody ({@link columbus.java.asg.base.Positioned Positioned}, single) : (missing) */ public interface Lambda extends FunctionalExpression { /** * Gives back the {@link columbus.java.asg.expr.Lambda#attributeLloc lloc} of the node. * @return Returns with the lloc. */ public int getLloc(); /** * Sets the {@link columbus.java.asg.expr.Lambda#attributeLloc lloc} of the node. * @param value The new value of the lloc. */ public void setLloc(int value); /** * Gives back the {@link columbus.java.asg.expr.Lambda#attributeParamKind paramKind} of the node. * @return Returns with the paramKind. */ public LambdaParameterKind getParamKind(); /** * Sets the {@link columbus.java.asg.expr.Lambda#attributeParamKind paramKind} of the node. * @param value The new value of the paramKind. */ public void setParamKind(LambdaParameterKind value); /** * Gives back the {@link columbus.java.asg.expr.Lambda#attributeBodyKind bodyKind} of the node. * @return Returns with the bodyKind. */ public LambdaBodyKind getBodyKind(); /** * Sets the {@link columbus.java.asg.expr.Lambda#attributeBodyKind bodyKind} of the node. * @param value The new value of the bodyKind. */ public void setBodyKind(LambdaBodyKind value); /** * Gives back iterator for the {@link columbus.java.asg.expr.Lambda#edgeHasParameters hasParameters} edges. * @return Returns an iterator for the hasParameters edges. */ public EdgeIterator<Parameter> getParametersIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.Lambda#edgeHasParameters hasParameters} edges or not. * @return Returns true if the node doesn't have any hasParameters edge. */ public boolean getParametersIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.Lambda#edgeHasParameters hasParameters} edges the node has. * @return Returns with the number of hasParameters edges. */ public int getParametersSize(); /** * Adds a new {@link columbus.java.asg.expr.Lambda#edgeHasParameters hasParameters} edge to the node. * @param id The end point of the new hasParameters edge. */ public void addParameters(int id); /** * Adds a new {@link columbus.java.asg.expr.Lambda#edgeHasParameters hasParameters} edge to the node. * @param node The end point of the new hasParameters edge. */ public void addParameters(Parameter node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Lambda#edgeHasBody hasBody} edge points to. * @return Returns the end point of the hasBody edge. */ public Positioned getBody(); /** * Sets the {@link columbus.java.asg.expr.Lambda#edgeHasBody hasBody} edge. * @param id The new end point of the hasBody edge. */ public void setBody(int id); /** * Sets the {@link columbus.java.asg.expr.Lambda#edgeHasBody hasBody} edge. * @param node The new end point of the hasBody edge. */ public void setBody(Positioned node); }
4,371
33.976
118
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/WildcardExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.WildcardExpression WildcardExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class WildcardExpressionImpl extends BaseImpl implements WildcardExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(WildcardExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected TypeBoundKind kind = TypeBoundKind.tbkWildcard; protected int _hasBound; public WildcardExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkWildcardExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public TypeBoundKind getKind() { return kind; } @Override public void setKind(TypeBoundKind _kind) { kind = _kind; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getBound() { if (_hasBound == 0) return null; if (factory.getIsFiltered(_hasBound)) return null; return (TypeExpression)factory.getRef(_hasBound); } @Override public void setBound(int _id) { if (_hasBound != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasBound" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasBound = _id; setParentEdge(_hasBound); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setBound(TypeExpression _node) { if (_hasBound != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasBound" )); _hasBound = _node.getId(); setParentEdge(_hasBound); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeUByte1(kind.ordinal()); io.writeInt4(!factory.getIsFiltered(_hasBound) ? _hasBound : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); kind = TypeBoundKind.values()[io.readUByte1()]; _hasBound = io.readInt4(); if (_hasBound != 0) setParentEdge(_hasBound); } }
8,147
23.917431
140
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeCastImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.TypeCast TypeCast} node. * <p><b>WARNING: For internal use only.</b></p> */ public class TypeCastImpl extends BaseImpl implements TypeCast { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(TypeCastImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; protected int _hasTypeOperand; public TypeCastImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkTypeCast; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } @Override public TypeExpression getTypeOperand() { if (_hasTypeOperand == 0) return null; if (factory.getIsFiltered(_hasTypeOperand)) return null; return (TypeExpression)factory.getRef(_hasTypeOperand); } @Override public void setTypeOperand(int _id) { if (_hasTypeOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasTypeOperand = _id; setParentEdge(_hasTypeOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTypeOperand(TypeExpression _node) { if (_hasTypeOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasTypeOperand" )); _hasTypeOperand = _node.getId(); setParentEdge(_hasTypeOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); io.writeInt4(!factory.getIsFiltered(_hasTypeOperand) ? _hasTypeOperand : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); _hasTypeOperand = io.readInt4(); if (_hasTypeOperand != 0) setParentEdge(_hasTypeOperand); } }
9,125
24.707042
130
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/MethodInvocationImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.struc.MethodDeclaration; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.MethodInvocation MethodInvocation} node. * <p><b>WARNING: For internal use only.</b></p> */ public class MethodInvocationImpl extends BaseImpl implements MethodInvocation { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(MethodInvocationImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; protected EdgeList<TypeExpression> _hasTypeArguments; protected EdgeList<Expression> _hasArguments; protected int _invokes; public MethodInvocationImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkMethodInvocation; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } @Override public EdgeIterator<TypeExpression> getTypeArgumentsIterator() { if (_hasTypeArguments == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasTypeArguments.iterator(); } @Override public boolean getTypeArgumentsIsEmpty() { if (_hasTypeArguments == null) return true; else return _hasTypeArguments.isEmpty(); } @Override public int getTypeArgumentsSize() { if (_hasTypeArguments == null) return 0; else return _hasTypeArguments.size(); } @Override public EdgeIterator<Expression> getArgumentsIterator() { if (_hasArguments == null) return EdgeList.<Expression>emptyList().iterator(); else return _hasArguments.iterator(); } @Override public boolean getArgumentsIsEmpty() { if (_hasArguments == null) return true; else return _hasArguments.isEmpty(); } @Override public int getArgumentsSize() { if (_hasArguments == null) return 0; else return _hasArguments.size(); } @Override public MethodDeclaration getInvokes() { if (_invokes == 0) return null; if (factory.getIsFiltered(_invokes)) return null; return (MethodDeclaration)factory.getRef(_invokes); } @Override public void addTypeArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addTypeArguments(TypeExpression _node) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_node); setParentEdge(_node); } @Override public void addArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addArguments(Expression _node) { if (_hasArguments == null) _hasArguments = new EdgeList<Expression>(factory); _hasArguments.add(_node); setParentEdge(_node); } @Override public void setInvokes(int _id) { if (_invokes != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","invokes" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkMethodDeclaration)) { _invokes = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setInvokes(MethodDeclaration _node) { if (_invokes != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","invokes" )); _invokes = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); io.writeInt4(!factory.getIsFiltered(_invokes) ? _invokes : 0); if (_hasTypeArguments != null) { EdgeIterator<TypeExpression> it = getTypeArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); if (_hasArguments != null) { EdgeIterator<Expression> it = getArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); _invokes = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasTypeArguments = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasTypeArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } _id = io.readInt4(); if (_id != 0) { _hasArguments = new EdgeList<Expression>(factory); while (_id != 0) { _hasArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
12,399
24.357873
138
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/DoubleLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface DoubleLiteral, which represents the {@link columbus.java.asg.expr.DoubleLiteral DoubleLiteral} node. * @columbus.node (missing) * @columbus.attr doubleValue (double) : (missing) */ public interface DoubleLiteral extends NumberLiteral { /** * Gives back the {@link columbus.java.asg.expr.DoubleLiteral#attributeDoubleValue doubleValue} of the node. * @return Returns with the doubleValue. */ public double getDoubleValue(); /** * Sets the {@link columbus.java.asg.expr.DoubleLiteral#attributeDoubleValue doubleValue} of the node. * @param value The new value of the doubleValue. */ public void setDoubleValue(double value); }
1,430
30.8
113
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NewArrayImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.NewArray NewArray} node. * <p><b>WARNING: For internal use only.</b></p> */ public class NewArrayImpl extends BaseImpl implements NewArray { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(NewArrayImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected Object leftBracePosition; protected int _hasComponentType; protected EdgeList<Expression> _hasDimensions; protected EdgeList<Expression> _hasInitializers; public NewArrayImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); leftBracePosition = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkNewArray; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public Range getLeftBracePosition() { return (Range)leftBracePosition; } @Override public void setLeftBracePosition(Range _leftBracePosition) { if (factory.getStringTable() == _leftBracePosition.getStringTable()) leftBracePosition = _leftBracePosition; else leftBracePosition = new Range(factory.getStringTable(), _leftBracePosition); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getComponentType() { if (_hasComponentType == 0) return null; if (factory.getIsFiltered(_hasComponentType)) return null; return (TypeExpression)factory.getRef(_hasComponentType); } @Override public EdgeIterator<Expression> getDimensionsIterator() { if (_hasDimensions == null) return EdgeList.<Expression>emptyList().iterator(); else return _hasDimensions.iterator(); } @Override public boolean getDimensionsIsEmpty() { if (_hasDimensions == null) return true; else return _hasDimensions.isEmpty(); } @Override public int getDimensionsSize() { if (_hasDimensions == null) return 0; else return _hasDimensions.size(); } @Override public EdgeIterator<Expression> getInitializersIterator() { if (_hasInitializers == null) return EdgeList.<Expression>emptyList().iterator(); else return _hasInitializers.iterator(); } @Override public boolean getInitializersIsEmpty() { if (_hasInitializers == null) return true; else return _hasInitializers.isEmpty(); } @Override public int getInitializersSize() { if (_hasInitializers == null) return 0; else return _hasInitializers.size(); } @Override public void setComponentType(int _id) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasComponentType = _id; setParentEdge(_hasComponentType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setComponentType(TypeExpression _node) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); _hasComponentType = _node.getId(); setParentEdge(_hasComponentType); } @Override public void addDimensions(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { if (_hasDimensions == null) _hasDimensions = new EdgeList<Expression>(factory); _hasDimensions.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addDimensions(Expression _node) { if (_hasDimensions == null) _hasDimensions = new EdgeList<Expression>(factory); _hasDimensions.add(_node); setParentEdge(_node); } @Override public void addInitializers(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { if (_hasInitializers == null) _hasInitializers = new EdgeList<Expression>(factory); _hasInitializers.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addInitializers(Expression _node) { if (_hasInitializers == null) _hasInitializers = new EdgeList<Expression>(factory); _hasInitializers.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(((Range)leftBracePosition).getPathKey()); io.writeInt4(((Range)leftBracePosition).getLine()); io.writeInt4(((Range)leftBracePosition).getCol()); io.writeInt4(((Range)leftBracePosition).getEndLine()); io.writeInt4(((Range)leftBracePosition).getEndCol()); io.writeInt4(((Range)leftBracePosition).getWideLine()); io.writeInt4(((Range)leftBracePosition).getWideCol()); io.writeInt4(((Range)leftBracePosition).getWideEndLine()); io.writeInt4(((Range)leftBracePosition).getWideEndCol()); io.writeInt4(!factory.getIsFiltered(_hasComponentType) ? _hasComponentType : 0); if (_hasDimensions != null) { EdgeIterator<Expression> it = getDimensionsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); if (_hasInitializers != null) { EdgeIterator<Expression> it = getInitializersIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); ((Range)leftBracePosition).setPathKey(io.readInt4()); ((Range)leftBracePosition).setLine(io.readInt4()); ((Range)leftBracePosition).setCol(io.readInt4()); ((Range)leftBracePosition).setEndLine(io.readInt4()); ((Range)leftBracePosition).setEndCol(io.readInt4()); ((Range)leftBracePosition).setWideLine(io.readInt4()); ((Range)leftBracePosition).setWideCol(io.readInt4()); ((Range)leftBracePosition).setWideEndLine(io.readInt4()); ((Range)leftBracePosition).setWideEndCol(io.readInt4()); _hasComponentType = io.readInt4(); if (_hasComponentType != 0) setParentEdge(_hasComponentType); _id = io.readInt4(); if (_id != 0) { _hasDimensions = new EdgeList<Expression>(factory); while (_id != 0) { _hasDimensions.add(_id); setParentEdge(_id); _id = io.readInt4(); } } _id = io.readInt4(); if (_id != 0) { _hasInitializers = new EdgeList<Expression>(factory); while (_id != 0) { _hasInitializers.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
12,790
25.427686
130
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeIntersectionExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface TypeIntersectionExpression, which represents the {@link columbus.java.asg.expr.TypeIntersectionExpression TypeIntersectionExpression} node. * @columbus.node (missing) * @columbus.edge hasBounds ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) */ public interface TypeIntersectionExpression extends TypeExpression { /** * Gives back iterator for the {@link columbus.java.asg.expr.TypeIntersectionExpression#edgeHasBounds hasBounds} edges. * @return Returns an iterator for the hasBounds edges. */ public EdgeIterator<TypeExpression> getBoundsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.TypeIntersectionExpression#edgeHasBounds hasBounds} edges or not. * @return Returns true if the node doesn't have any hasBounds edge. */ public boolean getBoundsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.TypeIntersectionExpression#edgeHasBounds hasBounds} edges the node has. * @return Returns with the number of hasBounds edges. */ public int getBoundsSize(); /** * Adds a new {@link columbus.java.asg.expr.TypeIntersectionExpression#edgeHasBounds hasBounds} edge to the node. * @param id The end point of the new hasBounds edge. */ public void addBounds(int id); /** * Adds a new {@link columbus.java.asg.expr.TypeIntersectionExpression#edgeHasBounds hasBounds} edge to the node. * @param node The end point of the new hasBounds edge. */ public void addBounds(TypeExpression node); }
2,322
35.296875
152
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeUnionExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface TypeUnionExpression, which represents the {@link columbus.java.asg.expr.TypeUnionExpression TypeUnionExpression} node. * @columbus.node (missing) * @columbus.edge hasAlternatives ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) */ public interface TypeUnionExpression extends TypeExpression { /** * Gives back iterator for the {@link columbus.java.asg.expr.TypeUnionExpression#edgeHasAlternatives hasAlternatives} edges. * @return Returns an iterator for the hasAlternatives edges. */ public EdgeIterator<TypeExpression> getAlternativesIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.TypeUnionExpression#edgeHasAlternatives hasAlternatives} edges or not. * @return Returns true if the node doesn't have any hasAlternatives edge. */ public boolean getAlternativesIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.TypeUnionExpression#edgeHasAlternatives hasAlternatives} edges the node has. * @return Returns with the number of hasAlternatives edges. */ public int getAlternativesSize(); /** * Adds a new {@link columbus.java.asg.expr.TypeUnionExpression#edgeHasAlternatives hasAlternatives} edge to the node. * @param id The end point of the new hasAlternatives edge. */ public void addAlternatives(int id); /** * Adds a new {@link columbus.java.asg.expr.TypeUnionExpression#edgeHasAlternatives hasAlternatives} edge to the node. * @param node The end point of the new hasAlternatives edge. */ public void addAlternatives(TypeExpression node); }
2,385
36.28125
131
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/IntegerLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface IntegerLiteral, which represents the {@link columbus.java.asg.expr.IntegerLiteral IntegerLiteral} node. * @columbus.node (missing) * @columbus.attr intValue (int) : (missing) */ public interface IntegerLiteral extends NumberLiteral { /** * Gives back the {@link columbus.java.asg.expr.IntegerLiteral#attributeIntValue intValue} of the node. * @return Returns with the intValue. */ public int getIntValue(); /** * Sets the {@link columbus.java.asg.expr.IntegerLiteral#attributeIntValue intValue} of the node. * @param value The new value of the intValue. */ public void setIntValue(int value); }
1,400
30.133333
116
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Literal.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface Literal, which represents the {@link columbus.java.asg.expr.Literal Literal} node. * @columbus.node (missing) */ public interface Literal extends Expression { }
947
28.625
95
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ExternalTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ExternalTypeExpression ExternalTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ExternalTypeExpressionImpl extends BaseImpl implements ExternalTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ExternalTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; public ExternalTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkExternalTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); } }
6,701
24.101124
144
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeApplyExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.TypeApplyExpression TypeApplyExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class TypeApplyExpressionImpl extends BaseImpl implements TypeApplyExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(TypeApplyExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasRawType; protected EdgeList<TypeExpression> _hasTypeArguments; public TypeApplyExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkTypeApplyExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getRawType() { if (_hasRawType == 0) return null; if (factory.getIsFiltered(_hasRawType)) return null; return (TypeExpression)factory.getRef(_hasRawType); } @Override public EdgeIterator<TypeExpression> getTypeArgumentsIterator() { if (_hasTypeArguments == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasTypeArguments.iterator(); } @Override public boolean getTypeArgumentsIsEmpty() { if (_hasTypeArguments == null) return true; else return _hasTypeArguments.isEmpty(); } @Override public int getTypeArgumentsSize() { if (_hasTypeArguments == null) return 0; else return _hasTypeArguments.size(); } @Override public void setRawType(int _id) { if (_hasRawType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRawType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasRawType = _id; setParentEdge(_hasRawType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setRawType(TypeExpression _node) { if (_hasRawType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRawType" )); _hasRawType = _node.getId(); setParentEdge(_hasRawType); } @Override public void addTypeArguments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addTypeArguments(TypeExpression _node) { if (_hasTypeArguments == null) _hasTypeArguments = new EdgeList<TypeExpression>(factory); _hasTypeArguments.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasRawType) ? _hasRawType : 0); if (_hasTypeArguments != null) { EdgeIterator<TypeExpression> it = getTypeArgumentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasRawType = io.readInt4(); if (_hasRawType != 0) setParentEdge(_hasRawType); _id = io.readInt4(); if (_id != 0) { _hasTypeArguments = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasTypeArguments.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
9,667
24.442105
141
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/WildcardExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.enums.*; /** * Interface WildcardExpression, which represents the {@link columbus.java.asg.expr.WildcardExpression WildcardExpression} node. * @columbus.node (missing) * @columbus.attr kind ({@link columbus.java.asg.enums.TypeBoundKind TypeBoundKind}) : (missing) * @columbus.edge hasBound ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface WildcardExpression extends TypeExpression { /** * Gives back the {@link columbus.java.asg.expr.WildcardExpression#attributeKind kind} of the node. * @return Returns with the kind. */ public TypeBoundKind getKind(); /** * Sets the {@link columbus.java.asg.expr.WildcardExpression#attributeKind kind} of the node. * @param value The new value of the kind. */ public void setKind(TypeBoundKind value); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.WildcardExpression#edgeHasBound hasBound} edge points to. * @return Returns the end point of the hasBound edge. */ public TypeExpression getBound(); /** * Sets the {@link columbus.java.asg.expr.WildcardExpression#edgeHasBound hasBound} edge. * @param id The new end point of the hasBound edge. */ public void setBound(int id); /** * Sets the {@link columbus.java.asg.expr.WildcardExpression#edgeHasBound hasBound} edge. * @param node The new end point of the hasBound edge. */ public void setBound(TypeExpression node); }
2,233
33.369231
132
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Assignment.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.enums.*; /** * Interface Assignment, which represents the {@link columbus.java.asg.expr.Assignment Assignment} node. * @columbus.node (missing) * @columbus.attr operator ({@link columbus.java.asg.enums.AssignmentOperatorKind AssignmentOperatorKind}) : (missing) */ public interface Assignment extends Binary { /** * Gives back the {@link columbus.java.asg.expr.Assignment#attributeOperator operator} of the node. * @return Returns with the operator. */ public AssignmentOperatorKind getOperator(); /** * Sets the {@link columbus.java.asg.expr.Assignment#attributeOperator operator} of the node. * @param value The new value of the operator. */ public void setOperator(AssignmentOperatorKind value); }
1,515
31.956522
118
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/PolyExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.enums.*; /** * Interface PolyExpression, which represents the {@link columbus.java.asg.expr.PolyExpression PolyExpression} node. * @columbus.node (missing) * @columbus.attr polyKind ({@link columbus.java.asg.enums.PolyExpressionKind PolyExpressionKind}) : (missing) */ public interface PolyExpression extends Expression { /** * Gives back the {@link columbus.java.asg.expr.PolyExpression#attributePolyKind polyKind} of the node. * @return Returns with the polyKind. */ public PolyExpressionKind getPolyKind(); /** * Sets the {@link columbus.java.asg.expr.PolyExpression#attributePolyKind polyKind} of the node. * @param value The new value of the polyKind. */ public void setPolyKind(PolyExpressionKind value); }
1,527
32.217391
116
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ParenthesizedExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ParenthesizedExpression ParenthesizedExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ParenthesizedExpressionImpl extends BaseImpl implements ParenthesizedExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ParenthesizedExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; public ParenthesizedExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkParenthesizedExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); } }
7,921
24.472669
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ArrayAccessImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ArrayAccess ArrayAccess} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ArrayAccessImpl extends BaseImpl implements ArrayAccess { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ArrayAccessImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasLeftOperand; protected int _hasRightOperand; public ArrayAccessImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkArrayAccess; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getLeftOperand() { if (_hasLeftOperand == 0) return null; if (factory.getIsFiltered(_hasLeftOperand)) return null; return (Expression)factory.getRef(_hasLeftOperand); } @Override public Expression getRightOperand() { if (_hasRightOperand == 0) return null; if (factory.getIsFiltered(_hasRightOperand)) return null; return (Expression)factory.getRef(_hasRightOperand); } @Override public void setLeftOperand(int _id) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasLeftOperand = _id; setParentEdge(_hasLeftOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setLeftOperand(Expression _node) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); _hasLeftOperand = _node.getId(); setParentEdge(_hasLeftOperand); } @Override public void setRightOperand(int _id) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasRightOperand = _id; setParentEdge(_hasRightOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setRightOperand(Expression _node) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); _hasRightOperand = _node.getId(); setParentEdge(_hasRightOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasLeftOperand) ? _hasLeftOperand : 0); io.writeInt4(!factory.getIsFiltered(_hasRightOperand) ? _hasRightOperand : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasLeftOperand = io.readInt4(); if (_hasLeftOperand != 0) setParentEdge(_hasLeftOperand); _hasRightOperand = io.readInt4(); if (_hasRightOperand != 0) setParentEdge(_hasRightOperand); } }
9,229
25.073446
133
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/StringLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.StringLiteral StringLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class StringLiteralImpl extends BaseImpl implements StringLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(StringLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int value; protected int formatString; public StringLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkStringLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getValue() { return factory.getStringTable().get(value); } @Override public int getValueKey() { return value; } @Override public String getFormatString() { return factory.getStringTable().get(formatString); } @Override public int getFormatStringKey() { return formatString; } @Override public void setValue(String _value) { value = factory.getStringTable().set(_value); } @Override public void setFormatString(String _formatString) { formatString = factory.getStringTable().set(_formatString); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(value); io.writeInt4(formatString); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); value = io.readInt4(); formatString = io.readInt4(); } }
7,359
22.973941
135
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/LambdaImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.struc.Parameter; import columbus.java.asg.base.Positioned; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Lambda Lambda} node. * <p><b>WARNING: For internal use only.</b></p> */ public class LambdaImpl extends BaseImpl implements Lambda { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(LambdaImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected PolyExpressionKind polyKind = PolyExpressionKind.pekStandalone; protected int _target; protected int lloc; protected LambdaParameterKind paramKind = LambdaParameterKind.lpkImplicit; protected LambdaBodyKind bodyKind = LambdaBodyKind.lbkExpression; protected EdgeList<Parameter> _hasParameters; protected int _hasBody; public LambdaImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkLambda; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public PolyExpressionKind getPolyKind() { return polyKind; } @Override public void setPolyKind(PolyExpressionKind _polyKind) { polyKind = _polyKind; } @Override public int getLloc() { return lloc; } @Override public LambdaParameterKind getParamKind() { return paramKind; } @Override public LambdaBodyKind getBodyKind() { return bodyKind; } @Override public void setLloc(int _lloc) { lloc = _lloc; } @Override public void setParamKind(LambdaParameterKind _paramKind) { paramKind = _paramKind; } @Override public void setBodyKind(LambdaBodyKind _bodyKind) { bodyKind = _bodyKind; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Type getTarget() { if (_target == 0) return null; if (factory.getIsFiltered(_target)) return null; return (Type)factory.getRef(_target); } @Override public void setTarget(int _id) { if (_target != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","target" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _target = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setTarget(Type _node) { if (_target != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","target" )); _target = _node.getId(); } @Override public EdgeIterator<Parameter> getParametersIterator() { if (_hasParameters == null) return EdgeList.<Parameter>emptyList().iterator(); else return _hasParameters.iterator(); } @Override public boolean getParametersIsEmpty() { if (_hasParameters == null) return true; else return _hasParameters.isEmpty(); } @Override public int getParametersSize() { if (_hasParameters == null) return 0; else return _hasParameters.size(); } @Override public Positioned getBody() { if (_hasBody == 0) return null; if (factory.getIsFiltered(_hasBody)) return null; return (Positioned)factory.getRef(_hasBody); } @Override public void addParameters(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (_node.getNodeKind() == NodeKind.ndkParameter) { if (_hasParameters == null) _hasParameters = new EdgeList<Parameter>(factory); _hasParameters.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addParameters(Parameter _node) { if (_hasParameters == null) _hasParameters = new EdgeList<Parameter>(factory); _hasParameters.add(_node); setParentEdge(_node); } @Override public void setBody(int _id) { if (_hasBody != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasBody" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression) || Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkStatement)) { _hasBody = _id; setParentEdge(_hasBody); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setBody(Positioned _node) { if (_hasBody != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasBody" )); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression) || Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkStatement)) { _hasBody = _node.getId(); setParentEdge(_hasBody); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeUByte1(polyKind.ordinal()); io.writeInt4(!factory.getIsFiltered(_target) ? _target : 0); io.writeInt4(lloc); io.writeUByte1(paramKind.ordinal()); io.writeUByte1(bodyKind.ordinal()); io.writeInt4(!factory.getIsFiltered(_hasBody) ? _hasBody : 0); if (_hasParameters != null) { EdgeIterator<Parameter> it = getParametersIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); polyKind = PolyExpressionKind.values()[io.readUByte1()]; _target = io.readInt4(); lloc = io.readInt4(); paramKind = LambdaParameterKind.values()[io.readUByte1()]; bodyKind = LambdaBodyKind.values()[io.readUByte1()]; _hasBody = io.readInt4(); if (_hasBody != 0) setParentEdge(_hasBody); _id = io.readInt4(); if (_id != 0) { _hasParameters = new EdgeList<Parameter>(factory); while (_id != 0) { _hasParameters.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
12,037
23.769547
152
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ErroneousTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.base.Positioned; /** * Interface ErroneousTypeExpression, which represents the {@link columbus.java.asg.expr.ErroneousTypeExpression ErroneousTypeExpression} node. * @columbus.node (missing) * @columbus.edge hasErrors ({@link columbus.java.asg.base.Positioned Positioned}, multiple) : (missing) */ public interface ErroneousTypeExpression extends TypeExpression { /** * Gives back iterator for the {@link columbus.java.asg.expr.ErroneousTypeExpression#edgeHasErrors hasErrors} edges. * @return Returns an iterator for the hasErrors edges. */ public EdgeIterator<Positioned> getErrorsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.ErroneousTypeExpression#edgeHasErrors hasErrors} edges or not. * @return Returns true if the node doesn't have any hasErrors edge. */ public boolean getErrorsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.ErroneousTypeExpression#edgeHasErrors hasErrors} edges the node has. * @return Returns with the number of hasErrors edges. */ public int getErrorsSize(); /** * Adds a new {@link columbus.java.asg.expr.ErroneousTypeExpression#edgeHasErrors hasErrors} edge to the node. * @param id The end point of the new hasErrors edge. */ public void addErrors(int id); /** * Adds a new {@link columbus.java.asg.expr.ErroneousTypeExpression#edgeHasErrors hasErrors} edge to the node. * @param node The end point of the new hasErrors edge. */ public void addErrors(Positioned node); }
2,321
34.723077
143
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NewClass.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; import columbus.java.asg.struc.AnonymousClass; import columbus.java.asg.struc.NormalMethod; /** * Interface NewClass, which represents the {@link columbus.java.asg.expr.NewClass NewClass} node. * @columbus.node (missing) * @columbus.edge hasEnclosingExpression ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) * @columbus.edge hasTypeArguments ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) * @columbus.edge hasTypeName ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) * @columbus.edge hasArguments ({@link columbus.java.asg.expr.Expression Expression}, multiple) : (missing) * @columbus.edge hasAnonymousClass ({@link columbus.java.asg.struc.AnonymousClass AnonymousClass}, single) : (missing) * @columbus.edge constructor ({@link columbus.java.asg.struc.NormalMethod NormalMethod}, single) : (missing) */ public interface NewClass extends Expression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.NewClass#edgeHasEnclosingExpression hasEnclosingExpression} edge points to. * @return Returns the end point of the hasEnclosingExpression edge. */ public Expression getEnclosingExpression(); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasEnclosingExpression hasEnclosingExpression} edge. * @param id The new end point of the hasEnclosingExpression edge. */ public void setEnclosingExpression(int id); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasEnclosingExpression hasEnclosingExpression} edge. * @param node The new end point of the hasEnclosingExpression edge. */ public void setEnclosingExpression(Expression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.NewClass#edgeHasTypeArguments hasTypeArguments} edges. * @return Returns an iterator for the hasTypeArguments edges. */ public EdgeIterator<TypeExpression> getTypeArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.NewClass#edgeHasTypeArguments hasTypeArguments} edges or not. * @return Returns true if the node doesn't have any hasTypeArguments edge. */ public boolean getTypeArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.NewClass#edgeHasTypeArguments hasTypeArguments} edges the node has. * @return Returns with the number of hasTypeArguments edges. */ public int getTypeArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.NewClass#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param id The end point of the new hasTypeArguments edge. */ public void addTypeArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.NewClass#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param node The end point of the new hasTypeArguments edge. */ public void addTypeArguments(TypeExpression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.NewClass#edgeHasTypeName hasTypeName} edge points to. * @return Returns the end point of the hasTypeName edge. */ public TypeExpression getTypeName(); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasTypeName hasTypeName} edge. * @param id The new end point of the hasTypeName edge. */ public void setTypeName(int id); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasTypeName hasTypeName} edge. * @param node The new end point of the hasTypeName edge. */ public void setTypeName(TypeExpression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.NewClass#edgeHasArguments hasArguments} edges. * @return Returns an iterator for the hasArguments edges. */ public EdgeIterator<Expression> getArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.NewClass#edgeHasArguments hasArguments} edges or not. * @return Returns true if the node doesn't have any hasArguments edge. */ public boolean getArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.NewClass#edgeHasArguments hasArguments} edges the node has. * @return Returns with the number of hasArguments edges. */ public int getArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.NewClass#edgeHasArguments hasArguments} edge to the node. * @param id The end point of the new hasArguments edge. */ public void addArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.NewClass#edgeHasArguments hasArguments} edge to the node. * @param node The end point of the new hasArguments edge. */ public void addArguments(Expression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.NewClass#edgeHasAnonymousClass hasAnonymousClass} edge points to. * @return Returns the end point of the hasAnonymousClass edge. */ public AnonymousClass getAnonymousClass(); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasAnonymousClass hasAnonymousClass} edge. * @param id The new end point of the hasAnonymousClass edge. */ public void setAnonymousClass(int id); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeHasAnonymousClass hasAnonymousClass} edge. * @param node The new end point of the hasAnonymousClass edge. */ public void setAnonymousClass(AnonymousClass node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.NewClass#edgeConstructor constructor} edge points to. * @return Returns the end point of the constructor edge. */ public NormalMethod getConstructor(); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeConstructor constructor} edge. * @param id The new end point of the constructor edge. */ public void setConstructor(int id); /** * Sets the {@link columbus.java.asg.expr.NewClass#edgeConstructor constructor} edge. * @param node The new end point of the constructor edge. */ public void setConstructor(NormalMethod node); }
6,799
38.306358
150
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/BooleanLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface BooleanLiteral, which represents the {@link columbus.java.asg.expr.BooleanLiteral BooleanLiteral} node. * @columbus.node (missing) * @columbus.attr booleanValue (boolean) : (missing) */ public interface BooleanLiteral extends Literal { /** * Gives back the {@link columbus.java.asg.expr.BooleanLiteral#attributeBooleanValue booleanValue} of the node. * @return Returns with the booleanValue. */ public boolean getBooleanValue(); /** * Sets the {@link columbus.java.asg.expr.BooleanLiteral#attributeBooleanValue booleanValue} of the node. * @param value The new value of the booleanValue. */ public void setBooleanValue(boolean value); }
1,442
31.066667
116
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/FieldAccessImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.FieldAccess FieldAccess} node. * <p><b>WARNING: For internal use only.</b></p> */ public class FieldAccessImpl extends BaseImpl implements FieldAccess { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(FieldAccessImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasLeftOperand; protected int _hasRightOperand; public FieldAccessImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkFieldAccess; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getLeftOperand() { if (_hasLeftOperand == 0) return null; if (factory.getIsFiltered(_hasLeftOperand)) return null; return (Expression)factory.getRef(_hasLeftOperand); } @Override public Expression getRightOperand() { if (_hasRightOperand == 0) return null; if (factory.getIsFiltered(_hasRightOperand)) return null; return (Expression)factory.getRef(_hasRightOperand); } @Override public void setLeftOperand(int _id) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasLeftOperand = _id; setParentEdge(_hasLeftOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setLeftOperand(Expression _node) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); _hasLeftOperand = _node.getId(); setParentEdge(_hasLeftOperand); } @Override public void setRightOperand(int _id) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasRightOperand = _id; setParentEdge(_hasRightOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setRightOperand(Expression _node) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); _hasRightOperand = _node.getId(); setParentEdge(_hasRightOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasLeftOperand) ? _hasLeftOperand : 0); io.writeInt4(!factory.getIsFiltered(_hasRightOperand) ? _hasRightOperand : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasLeftOperand = io.readInt4(); if (_hasLeftOperand != 0) setParentEdge(_hasLeftOperand); _hasRightOperand = io.readInt4(); if (_hasRightOperand != 0) setParentEdge(_hasRightOperand); } }
9,229
25.073446
133
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ErroneousImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.base.Positioned; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Erroneous Erroneous} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ErroneousImpl extends BaseImpl implements Erroneous { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ErroneousImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected EdgeList<Positioned> _hasErrors; public ErroneousImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkErroneous; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public EdgeIterator<Positioned> getErrorsIterator() { if (_hasErrors == null) return EdgeList.<Positioned>emptyList().iterator(); else return _hasErrors.iterator(); } @Override public boolean getErrorsIsEmpty() { if (_hasErrors == null) return true; else return _hasErrors.isEmpty(); } @Override public int getErrorsSize() { if (_hasErrors == null) return 0; else return _hasErrors.size(); } @Override public void addErrors(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkPositioned)) { if (_hasErrors == null) _hasErrors = new EdgeList<Positioned>(factory); _hasErrors.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addErrors(Positioned _node) { if (_hasErrors == null) _hasErrors = new EdgeList<Positioned>(factory); _hasErrors.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); if (_hasErrors != null) { EdgeIterator<Positioned> it = getErrorsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasErrors = new EdgeList<Positioned>(factory); while (_id != 0) { _hasErrors.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
8,220
23.394659
131
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/IdentifierImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.base.Named; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Identifier Identifier} node. * <p><b>WARNING: For internal use only.</b></p> */ public class IdentifierImpl extends BaseImpl implements Identifier { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(IdentifierImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int name; protected int _refersTo; public IdentifierImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkIdentifier; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getName() { return factory.getStringTable().get(name); } @Override public int getNameKey() { return name; } @Override public void setName(String _name) { name = factory.getStringTable().set(_name); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Named getRefersTo() { if (_refersTo == 0) return null; if (factory.getIsFiltered(_refersTo)) return null; return (Named)factory.getRef(_refersTo); } @Override public void setRefersTo(int _id) { if (_refersTo != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","refersTo" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkNamed)) { _refersTo = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setRefersTo(Named _node) { if (_refersTo != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","refersTo" )); _refersTo = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(name); io.writeInt4(!factory.getIsFiltered(_refersTo) ? _refersTo : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); name = io.readInt4(); _refersTo = io.readInt4(); } }
8,020
23.379939
132
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/FieldAccess.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface FieldAccess, which represents the {@link columbus.java.asg.expr.FieldAccess FieldAccess} node. * @columbus.node (missing) */ public interface FieldAccess extends Binary { }
959
29
107
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/LongLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.LongLiteral LongLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class LongLiteralImpl extends BaseImpl implements LongLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(LongLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int value; protected long longValue; public LongLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkLongLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getValue() { return factory.getStringTable().get(value); } @Override public int getValueKey() { return value; } @Override public void setValue(String _value) { value = factory.getStringTable().set(_value); } @Override public long getLongValue() { return longValue; } @Override public void setLongValue(long _longValue) { longValue = _longValue; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(value); io.writeLong8(longValue); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); value = io.readInt4(); longValue = io.readLong8(); } }
7,186
22.641447
133
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Annotation.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface Annotation, which represents the {@link columbus.java.asg.expr.Annotation Annotation} node. * @columbus.node (missing) * @columbus.edge hasAnnotationName ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface Annotation extends Expression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Annotation#edgeHasAnnotationName hasAnnotationName} edge points to. * @return Returns the end point of the hasAnnotationName edge. */ public TypeExpression getAnnotationName(); /** * Sets the {@link columbus.java.asg.expr.Annotation#edgeHasAnnotationName hasAnnotationName} edge. * @param id The new end point of the hasAnnotationName edge. */ public void setAnnotationName(int id); /** * Sets the {@link columbus.java.asg.expr.Annotation#edgeHasAnnotationName hasAnnotationName} edge. * @param node The new end point of the hasAnnotationName edge. */ public void setAnnotationName(TypeExpression node); }
1,786
34.039216
142
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ParenthesizedExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface ParenthesizedExpression, which represents the {@link columbus.java.asg.expr.ParenthesizedExpression ParenthesizedExpression} node. * @columbus.node (missing) */ public interface ParenthesizedExpression extends Unary { }
1,006
30.46875
143
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeUnionExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.TypeUnionExpression TypeUnionExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class TypeUnionExpressionImpl extends BaseImpl implements TypeUnionExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(TypeUnionExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected EdgeList<TypeExpression> _hasAlternatives; public TypeUnionExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkTypeUnionExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public EdgeIterator<TypeExpression> getAlternativesIterator() { if (_hasAlternatives == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasAlternatives.iterator(); } @Override public boolean getAlternativesIsEmpty() { if (_hasAlternatives == null) return true; else return _hasAlternatives.isEmpty(); } @Override public int getAlternativesSize() { if (_hasAlternatives == null) return 0; else return _hasAlternatives.size(); } @Override public void addAlternatives(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasAlternatives == null) _hasAlternatives = new EdgeList<TypeExpression>(factory); _hasAlternatives.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addAlternatives(TypeExpression _node) { if (_hasAlternatives == null) _hasAlternatives = new EdgeList<TypeExpression>(factory); _hasAlternatives.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); if (_hasAlternatives != null) { EdgeIterator<TypeExpression> it = getAlternativesIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasAlternatives = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasAlternatives.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
8,416
24.050595
141
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ArrayTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface ArrayTypeExpression, which represents the {@link columbus.java.asg.expr.ArrayTypeExpression ArrayTypeExpression} node. * @columbus.node (missing) * @columbus.edge hasComponentType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface ArrayTypeExpression extends TypeExpression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.ArrayTypeExpression#edgeHasComponentType hasComponentType} edge points to. * @return Returns the end point of the hasComponentType edge. */ public TypeExpression getComponentType(); /** * Sets the {@link columbus.java.asg.expr.ArrayTypeExpression#edgeHasComponentType hasComponentType} edge. * @param id The new end point of the hasComponentType edge. */ public void setComponentType(int id); /** * Sets the {@link columbus.java.asg.expr.ArrayTypeExpression#edgeHasComponentType hasComponentType} edge. * @param node The new end point of the hasComponentType edge. */ public void setComponentType(TypeExpression node); }
1,840
35.098039
149
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Binary.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface Binary, which represents the {@link columbus.java.asg.expr.Binary Binary} node. * @columbus.node (missing) * @columbus.edge hasLeftOperand ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) * @columbus.edge hasRightOperand ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) */ public interface Binary extends Expression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Binary#edgeHasLeftOperand hasLeftOperand} edge points to. * @return Returns the end point of the hasLeftOperand edge. */ public Expression getLeftOperand(); /** * Sets the {@link columbus.java.asg.expr.Binary#edgeHasLeftOperand hasLeftOperand} edge. * @param id The new end point of the hasLeftOperand edge. */ public void setLeftOperand(int id); /** * Sets the {@link columbus.java.asg.expr.Binary#edgeHasLeftOperand hasLeftOperand} edge. * @param node The new end point of the hasLeftOperand edge. */ public void setLeftOperand(Expression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Binary#edgeHasRightOperand hasRightOperand} edge points to. * @return Returns the end point of the hasRightOperand edge. */ public Expression getRightOperand(); /** * Sets the {@link columbus.java.asg.expr.Binary#edgeHasRightOperand hasRightOperand} edge. * @param id The new end point of the hasRightOperand edge. */ public void setRightOperand(int id); /** * Sets the {@link columbus.java.asg.expr.Binary#edgeHasRightOperand hasRightOperand} edge. * @param node The new end point of the hasRightOperand edge. */ public void setRightOperand(Expression node); }
2,476
34.385714
134
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface TypeExpression, which represents the {@link columbus.java.asg.expr.TypeExpression TypeExpression} node. * @columbus.node (missing) */ public interface TypeExpression extends Expression { }
975
29.5
116
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeCast.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface TypeCast, which represents the {@link columbus.java.asg.expr.TypeCast TypeCast} node. * @columbus.node (missing) * @columbus.edge hasTypeOperand ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface TypeCast extends Unary { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.TypeCast#edgeHasTypeOperand hasTypeOperand} edge points to. * @return Returns the end point of the hasTypeOperand edge. */ public TypeExpression getTypeOperand(); /** * Sets the {@link columbus.java.asg.expr.TypeCast#edgeHasTypeOperand hasTypeOperand} edge. * @param id The new end point of the hasTypeOperand edge. */ public void setTypeOperand(int id); /** * Sets the {@link columbus.java.asg.expr.TypeCast#edgeHasTypeOperand hasTypeOperand} edge. * @param node The new end point of the hasTypeOperand edge. */ public void setTypeOperand(TypeExpression node); }
1,728
32.901961
134
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NullLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.NullLiteral NullLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class NullLiteralImpl extends BaseImpl implements NullLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(NullLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; public NullLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkNullLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); } }
6,624
23.812734
133
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/AnnotatedTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.AnnotatedTypeExpression AnnotatedTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class AnnotatedTypeExpressionImpl extends BaseImpl implements AnnotatedTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(AnnotatedTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected EdgeList<Annotation> _hasAnnotations; protected int _hasUnderlyingType; public AnnotatedTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkAnnotatedTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public EdgeIterator<Annotation> getAnnotationsIterator() { if (_hasAnnotations == null) return EdgeList.<Annotation>emptyList().iterator(); else return _hasAnnotations.iterator(); } @Override public boolean getAnnotationsIsEmpty() { if (_hasAnnotations == null) return true; else return _hasAnnotations.isEmpty(); } @Override public int getAnnotationsSize() { if (_hasAnnotations == null) return 0; else return _hasAnnotations.size(); } @Override public TypeExpression getUnderlyingType() { if (_hasUnderlyingType == 0) return null; if (factory.getIsFiltered(_hasUnderlyingType)) return null; return (TypeExpression)factory.getRef(_hasUnderlyingType); } @Override public void addAnnotations(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkAnnotation)) { if (_hasAnnotations == null) _hasAnnotations = new EdgeList<Annotation>(factory); _hasAnnotations.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addAnnotations(Annotation _node) { if (_hasAnnotations == null) _hasAnnotations = new EdgeList<Annotation>(factory); _hasAnnotations.add(_node); setParentEdge(_node); } @Override public void setUnderlyingType(int _id) { if (_hasUnderlyingType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasUnderlyingType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasUnderlyingType = _id; setParentEdge(_hasUnderlyingType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setUnderlyingType(TypeExpression _node) { if (_hasUnderlyingType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasUnderlyingType" )); _hasUnderlyingType = _node.getId(); setParentEdge(_hasUnderlyingType); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasUnderlyingType) ? _hasUnderlyingType : 0); if (_hasAnnotations != null) { EdgeIterator<Annotation> it = getAnnotationsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasUnderlyingType = io.readInt4(); if (_hasUnderlyingType != 0) setParentEdge(_hasUnderlyingType); _id = io.readInt4(); if (_id != 0) { _hasAnnotations = new EdgeList<Annotation>(factory); while (_id != 0) { _hasAnnotations.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
9,755
24.673684
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ArrayAccess.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface ArrayAccess, which represents the {@link columbus.java.asg.expr.ArrayAccess ArrayAccess} node. * @columbus.node (missing) */ public interface ArrayAccess extends Binary { }
959
29
107
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/AssignmentImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.Assignment Assignment} node. * <p><b>WARNING: For internal use only.</b></p> */ public class AssignmentImpl extends BaseImpl implements Assignment { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(AssignmentImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasLeftOperand; protected int _hasRightOperand; protected AssignmentOperatorKind operator = AssignmentOperatorKind.askAssign; public AssignmentImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkAssignment; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public AssignmentOperatorKind getOperator() { return operator; } @Override public void setOperator(AssignmentOperatorKind _operator) { operator = _operator; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getLeftOperand() { if (_hasLeftOperand == 0) return null; if (factory.getIsFiltered(_hasLeftOperand)) return null; return (Expression)factory.getRef(_hasLeftOperand); } @Override public Expression getRightOperand() { if (_hasRightOperand == 0) return null; if (factory.getIsFiltered(_hasRightOperand)) return null; return (Expression)factory.getRef(_hasRightOperand); } @Override public void setLeftOperand(int _id) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasLeftOperand = _id; setParentEdge(_hasLeftOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setLeftOperand(Expression _node) { if (_hasLeftOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasLeftOperand" )); _hasLeftOperand = _node.getId(); setParentEdge(_hasLeftOperand); } @Override public void setRightOperand(int _id) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasRightOperand = _id; setParentEdge(_hasRightOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setRightOperand(Expression _node) { if (_hasRightOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasRightOperand" )); _hasRightOperand = _node.getId(); setParentEdge(_hasRightOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasLeftOperand) ? _hasLeftOperand : 0); io.writeInt4(!factory.getIsFiltered(_hasRightOperand) ? _hasRightOperand : 0); io.writeUByte1(operator.ordinal()); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasLeftOperand = io.readInt4(); if (_hasLeftOperand != 0) setParentEdge(_hasLeftOperand); _hasRightOperand = io.readInt4(); if (_hasRightOperand != 0) setParentEdge(_hasRightOperand); operator = AssignmentOperatorKind.values()[io.readUByte1()]; } }
9,586
24.910811
132
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NumberLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface NumberLiteral, which represents the {@link columbus.java.asg.expr.NumberLiteral NumberLiteral} node. * @columbus.node (missing) * @columbus.attr value (String) : (missing) */ public interface NumberLiteral extends Literal { /** * Gives back the {@link columbus.java.asg.expr.NumberLiteral#attributeValue value} of the node. * @return Returns with the value. */ public String getValue(); /** * Gives back the Key of {@link columbus.java.asg.expr.NumberLiteral#attributeValue value} of the node. * @return Returns with the Key of the value. */ public int getValueKey(); /** * Sets the {@link columbus.java.asg.expr.NumberLiteral#attributeValue value} of the node. * @param value The new value of the value. */ public void setValue(String value); }
1,560
29.607843
113
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/PostfixExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.PostfixExpression PostfixExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class PostfixExpressionImpl extends BaseImpl implements PostfixExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(PostfixExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasOperand; protected PostfixOperatorKind operator = PostfixOperatorKind.pookIncrement; public PostfixExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkPostfixExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public PostfixOperatorKind getOperator() { return operator; } @Override public void setOperator(PostfixOperatorKind _operator) { operator = _operator; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public Expression getOperand() { if (_hasOperand == 0) return null; if (factory.getIsFiltered(_hasOperand)) return null; return (Expression)factory.getRef(_hasOperand); } @Override public void setOperand(int _id) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkExpression)) { _hasOperand = _id; setParentEdge(_hasOperand); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setOperand(Expression _node) { if (_hasOperand != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasOperand" )); _hasOperand = _node.getId(); setParentEdge(_hasOperand); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasOperand) ? _hasOperand : 0); io.writeUByte1(operator.ordinal()); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasOperand = io.readInt4(); if (_hasOperand != 0) setParentEdge(_hasOperand); operator = PostfixOperatorKind.values()[io.readUByte1()]; } }
8,232
24.17737
139
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/QualifiedTypeExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface QualifiedTypeExpression, which represents the {@link columbus.java.asg.expr.QualifiedTypeExpression QualifiedTypeExpression} node. * @columbus.node (missing) * @columbus.edge hasQualifierType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) * @columbus.edge hasSimpleType ({@link columbus.java.asg.expr.SimpleTypeExpression SimpleTypeExpression}, single) : (missing) */ public interface QualifiedTypeExpression extends TypeExpression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasQualifierType hasQualifierType} edge points to. * @return Returns the end point of the hasQualifierType edge. */ public TypeExpression getQualifierType(); /** * Sets the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasQualifierType hasQualifierType} edge. * @param id The new end point of the hasQualifierType edge. */ public void setQualifierType(int id); /** * Sets the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasQualifierType hasQualifierType} edge. * @param node The new end point of the hasQualifierType edge. */ public void setQualifierType(TypeExpression node); /** * Gives back the reference of the node the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasSimpleType hasSimpleType} edge points to. * @return Returns the end point of the hasSimpleType edge. */ public SimpleTypeExpression getSimpleType(); /** * Sets the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasSimpleType hasSimpleType} edge. * @param id The new end point of the hasSimpleType edge. */ public void setSimpleType(int id); /** * Sets the {@link columbus.java.asg.expr.QualifiedTypeExpression#edgeHasSimpleType hasSimpleType} edge. * @param node The new end point of the hasSimpleType edge. */ public void setSimpleType(SimpleTypeExpression node); }
2,706
37.671429
153
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/IntegerLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.IntegerLiteral IntegerLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class IntegerLiteralImpl extends BaseImpl implements IntegerLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(IntegerLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int value; protected int intValue; public IntegerLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkIntegerLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getValue() { return factory.getStringTable().get(value); } @Override public int getValueKey() { return value; } @Override public void setValue(String _value) { value = factory.getStringTable().set(_value); } @Override public int getIntValue() { return intValue; } @Override public void setIntValue(int _intValue) { intValue = _intValue; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(value); io.writeInt4(intValue); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); value = io.readInt4(); intValue = io.readInt4(); } }
7,193
22.664474
136
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/DoubleLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.DoubleLiteral DoubleLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class DoubleLiteralImpl extends BaseImpl implements DoubleLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(DoubleLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int value; protected double doubleValue; public DoubleLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkDoubleLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public String getValue() { return factory.getStringTable().get(value); } @Override public int getValueKey() { return value; } @Override public void setValue(String _value) { value = factory.getStringTable().set(_value); } @Override public double getDoubleValue() { return doubleValue; } @Override public void setDoubleValue(double _doubleValue) { doubleValue = _doubleValue; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(value); io.writeDouble8(doubleValue); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); value = io.readInt4(); doubleValue = io.readDouble8(); } }
7,228
22.779605
135
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ErroneousTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.base.Positioned; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ErroneousTypeExpression ErroneousTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ErroneousTypeExpressionImpl extends BaseImpl implements ErroneousTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ErroneousTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected EdgeList<Positioned> _hasErrors; public ErroneousTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkErroneousTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public EdgeIterator<Positioned> getErrorsIterator() { if (_hasErrors == null) return EdgeList.<Positioned>emptyList().iterator(); else return _hasErrors.iterator(); } @Override public boolean getErrorsIsEmpty() { if (_hasErrors == null) return true; else return _hasErrors.isEmpty(); } @Override public int getErrorsSize() { if (_hasErrors == null) return 0; else return _hasErrors.size(); } @Override public void addErrors(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkPositioned)) { if (_hasErrors == null) _hasErrors = new EdgeList<Positioned>(factory); _hasErrors.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addErrors(Positioned _node) { if (_hasErrors == null) _hasErrors = new EdgeList<Positioned>(factory); _hasErrors.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); if (_hasErrors != null) { EdgeIterator<Positioned> it = getErrorsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasErrors = new EdgeList<Positioned>(factory); while (_id != 0) { _hasErrors.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
8,318
23.68546
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/LongLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface LongLiteral, which represents the {@link columbus.java.asg.expr.LongLiteral LongLiteral} node. * @columbus.node (missing) * @columbus.attr longValue (long) : (missing) */ public interface LongLiteral extends NumberLiteral { /** * Gives back the {@link columbus.java.asg.expr.LongLiteral#attributeLongValue longValue} of the node. * @return Returns with the longValue. */ public long getLongValue(); /** * Sets the {@link columbus.java.asg.expr.LongLiteral#attributeLongValue longValue} of the node. * @param value The new value of the longValue. */ public void setLongValue(long value); }
1,394
30
107
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ArrayTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.ArrayTypeExpression ArrayTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class ArrayTypeExpressionImpl extends BaseImpl implements ArrayTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(ArrayTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasComponentType; public ArrayTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkArrayTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getComponentType() { if (_hasComponentType == 0) return null; if (factory.getIsFiltered(_hasComponentType)) return null; return (TypeExpression)factory.getRef(_hasComponentType); } @Override public void setComponentType(int _id) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasComponentType = _id; setParentEdge(_hasComponentType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setComponentType(TypeExpression _node) { if (_hasComponentType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasComponentType" )); _hasComponentType = _node.getId(); setParentEdge(_hasComponentType); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasComponentType) ? _hasComponentType : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasComponentType = io.readInt4(); if (_hasComponentType != 0) setParentEdge(_hasComponentType); } }
8,029
24.819936
141
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/Unary.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface Unary, which represents the {@link columbus.java.asg.expr.Unary Unary} node. * @columbus.node (missing) * @columbus.edge hasOperand ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) */ public interface Unary extends Expression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.Unary#edgeHasOperand hasOperand} edge points to. * @return Returns the end point of the hasOperand edge. */ public Expression getOperand(); /** * Sets the {@link columbus.java.asg.expr.Unary#edgeHasOperand hasOperand} edge. * @param id The new end point of the hasOperand edge. */ public void setOperand(int id); /** * Sets the {@link columbus.java.asg.expr.Unary#edgeHasOperand hasOperand} edge. * @param node The new end point of the hasOperand edge. */ public void setOperand(Expression node); }
1,644
31.254902
123
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/QualifiedTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.QualifiedTypeExpression QualifiedTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class QualifiedTypeExpressionImpl extends BaseImpl implements QualifiedTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(QualifiedTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected int _hasQualifierType; protected int _hasSimpleType; public QualifiedTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkQualifiedTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public TypeExpression getQualifierType() { if (_hasQualifierType == 0) return null; if (factory.getIsFiltered(_hasQualifierType)) return null; return (TypeExpression)factory.getRef(_hasQualifierType); } @Override public SimpleTypeExpression getSimpleType() { if (_hasSimpleType == 0) return null; if (factory.getIsFiltered(_hasSimpleType)) return null; return (SimpleTypeExpression)factory.getRef(_hasSimpleType); } @Override public void setQualifierType(int _id) { if (_hasQualifierType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasQualifierType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { _hasQualifierType = _id; setParentEdge(_hasQualifierType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setQualifierType(TypeExpression _node) { if (_hasQualifierType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasQualifierType" )); _hasQualifierType = _node.getId(); setParentEdge(_hasQualifierType); } @Override public void setSimpleType(int _id) { if (_hasSimpleType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasSimpleType" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (_node.getNodeKind() == NodeKind.ndkSimpleTypeExpression) { _hasSimpleType = _id; setParentEdge(_hasSimpleType); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setSimpleType(SimpleTypeExpression _node) { if (_hasSimpleType != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","hasSimpleType" )); _hasSimpleType = _node.getId(); setParentEdge(_hasSimpleType); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeInt4(!factory.getIsFiltered(_hasQualifierType) ? _hasQualifierType : 0); io.writeInt4(!factory.getIsFiltered(_hasSimpleType) ? _hasSimpleType : 0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _hasQualifierType = io.readInt4(); if (_hasQualifierType != 0) setParentEdge(_hasQualifierType); _hasSimpleType = io.readInt4(); if (_hasSimpleType != 0) setParentEdge(_hasSimpleType); } }
9,344
25.398305
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeIntersectionExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.TypeIntersectionExpression TypeIntersectionExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class TypeIntersectionExpressionImpl extends BaseImpl implements TypeIntersectionExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(TypeIntersectionExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected EdgeList<TypeExpression> _hasBounds; public TypeIntersectionExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkTypeIntersectionExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } @Override public EdgeIterator<TypeExpression> getBoundsIterator() { if (_hasBounds == null) return EdgeList.<TypeExpression>emptyList().iterator(); else return _hasBounds.iterator(); } @Override public boolean getBoundsIsEmpty() { if (_hasBounds == null) return true; else return _hasBounds.isEmpty(); } @Override public int getBoundsSize() { if (_hasBounds == null) return 0; else return _hasBounds.size(); } @Override public void addBounds(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkTypeExpression)) { if (_hasBounds == null) _hasBounds = new EdgeList<TypeExpression>(factory); _hasBounds.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } setParentEdge(_id); } @Override public void addBounds(TypeExpression _node) { if (_hasBounds == null) _hasBounds = new EdgeList<TypeExpression>(factory); _hasBounds.add(_node); setParentEdge(_node); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); if (_hasBounds != null) { EdgeIterator<TypeExpression> it = getBoundsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); _id = io.readInt4(); if (_id != 0) { _hasBounds = new EdgeList<TypeExpression>(factory); while (_id != 0) { _hasBounds.add(_id); setParentEdge(_id); _id = io.readInt4(); } } } }
8,333
23.803571
148
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/SingleElementAnnotation.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface SingleElementAnnotation, which represents the {@link columbus.java.asg.expr.SingleElementAnnotation SingleElementAnnotation} node. * @columbus.node (missing) * @columbus.edge hasArgument ({@link columbus.java.asg.expr.Expression Expression}, single) : (missing) */ public interface SingleElementAnnotation extends Annotation { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.SingleElementAnnotation#edgeHasArgument hasArgument} edge points to. * @return Returns the end point of the hasArgument edge. */ public Expression getArgument(); /** * Sets the {@link columbus.java.asg.expr.SingleElementAnnotation#edgeHasArgument hasArgument} edge. * @param id The new end point of the hasArgument edge. */ public void setArgument(int id); /** * Sets the {@link columbus.java.asg.expr.SingleElementAnnotation#edgeHasArgument hasArgument} edge. * @param node The new end point of the hasArgument edge. */ public void setArgument(Expression node); }
1,783
33.980392
143
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/This.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface This, which represents the {@link columbus.java.asg.expr.This This} node. * @columbus.node (missing) */ public interface This extends Expression { }
935
28.25
86
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/PrimitiveTypeExpressionImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.PrimitiveTypeExpression PrimitiveTypeExpression} node. * <p><b>WARNING: For internal use only.</b></p> */ public class PrimitiveTypeExpressionImpl extends BaseImpl implements PrimitiveTypeExpression { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(PrimitiveTypeExpressionImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected PrimitiveTypeKind kind = PrimitiveTypeKind.ptkVoid; public PrimitiveTypeExpressionImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkPrimitiveTypeExpression; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public PrimitiveTypeKind getKind() { return kind; } @Override public void setKind(PrimitiveTypeKind _kind) { kind = _kind; } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeUByte1(kind.ordinal()); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); kind = PrimitiveTypeKind.values()[io.readUByte1()]; } }
7,009
23.770318
145
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/NormalAnnotation.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface NormalAnnotation, which represents the {@link columbus.java.asg.expr.NormalAnnotation NormalAnnotation} node. * @columbus.node (missing) * @columbus.edge hasArguments ({@link columbus.java.asg.expr.Expression Expression}, multiple) : (missing) */ public interface NormalAnnotation extends Annotation { /** * Gives back iterator for the {@link columbus.java.asg.expr.NormalAnnotation#edgeHasArguments hasArguments} edges. * @return Returns an iterator for the hasArguments edges. */ public EdgeIterator<Expression> getArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.NormalAnnotation#edgeHasArguments hasArguments} edges or not. * @return Returns true if the node doesn't have any hasArguments edge. */ public boolean getArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.NormalAnnotation#edgeHasArguments hasArguments} edges the node has. * @return Returns with the number of hasArguments edges. */ public int getArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.NormalAnnotation#edgeHasArguments hasArguments} edge to the node. * @param id The end point of the new hasArguments edge. */ public void addArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.NormalAnnotation#edgeHasArguments hasArguments} edge to the node. * @param node The end point of the new hasArguments edge. */ public void addArguments(Expression node); }
2,275
34.5625
122
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/TypeApplyExpression.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.java.asg.*; /** * Interface TypeApplyExpression, which represents the {@link columbus.java.asg.expr.TypeApplyExpression TypeApplyExpression} node. * @columbus.node (missing) * @columbus.edge hasRawType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) * @columbus.edge hasTypeArguments ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, multiple) : (missing) */ public interface TypeApplyExpression extends TypeExpression { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasRawType hasRawType} edge points to. * @return Returns the end point of the hasRawType edge. */ public TypeExpression getRawType(); /** * Sets the {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasRawType hasRawType} edge. * @param id The new end point of the hasRawType edge. */ public void setRawType(int id); /** * Sets the {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasRawType hasRawType} edge. * @param node The new end point of the hasRawType edge. */ public void setRawType(TypeExpression node); /** * Gives back iterator for the {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasTypeArguments hasTypeArguments} edges. * @return Returns an iterator for the hasTypeArguments edges. */ public EdgeIterator<TypeExpression> getTypeArgumentsIterator(); /** * Tells whether the node has {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasTypeArguments hasTypeArguments} edges or not. * @return Returns true if the node doesn't have any hasTypeArguments edge. */ public boolean getTypeArgumentsIsEmpty(); /** * Gives back how many {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasTypeArguments hasTypeArguments} edges the node has. * @return Returns with the number of hasTypeArguments edges. */ public int getTypeArgumentsSize(); /** * Adds a new {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param id The end point of the new hasTypeArguments edge. */ public void addTypeArguments(int id); /** * Adds a new {@link columbus.java.asg.expr.TypeApplyExpression#edgeHasTypeArguments hasTypeArguments} edge to the node. * @param node The end point of the new hasTypeArguments edge. */ public void addTypeArguments(TypeExpression node); }
3,169
37.192771
137
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/ClassLiteral.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; /** * Interface ClassLiteral, which represents the {@link columbus.java.asg.expr.ClassLiteral ClassLiteral} node. * @columbus.node (missing) * @columbus.edge hasComponentType ({@link columbus.java.asg.expr.TypeExpression TypeExpression}, single) : (missing) */ public interface ClassLiteral extends Literal { /** * Gives back the reference of the node the {@link columbus.java.asg.expr.ClassLiteral#edgeHasComponentType hasComponentType} edge points to. * @return Returns the end point of the hasComponentType edge. */ public TypeExpression getComponentType(); /** * Sets the {@link columbus.java.asg.expr.ClassLiteral#edgeHasComponentType hasComponentType} edge. * @param id The new end point of the hasComponentType edge. */ public void setComponentType(int id); /** * Sets the {@link columbus.java.asg.expr.ClassLiteral#edgeHasComponentType hasComponentType} edge. * @param node The new end point of the hasComponentType edge. */ public void setComponentType(TypeExpression node); }
1,784
34
142
java
OpenStaticAnalyzer
OpenStaticAnalyzer-master/java/lib/java/src/main/java/columbus/java/asg/expr/CharacterLiteralImpl.java
/* * This file is part of OpenStaticAnalyzer. * * Copyright (c) 2004-2018 Department of Software Engineering - University of Szeged * * Licensed under Version 1.2 of the EUPL (the "Licence"); * * You may not use this work except in compliance with the Licence. * * You may obtain a copy of the Licence in the LICENSE file or at: * * https://joinup.ec.europa.eu/software/page/eupl * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. */ package columbus.java.asg.expr; import columbus.IO; import columbus.java.asg.*; import columbus.java.asg.base.BaseImpl; import columbus.java.asg.base.Base; import columbus.java.asg.type.Type; import columbus.java.asg.base.Comment; import columbus.java.asg.enums.*; import columbus.java.asg.visitors.Visitor; import columbus.logger.LoggerHandler; /** * Implementation class for the {@link columbus.java.asg.expr.CharacterLiteral CharacterLiteral} node. * <p><b>WARNING: For internal use only.</b></p> */ public class CharacterLiteralImpl extends BaseImpl implements CharacterLiteral { @SuppressWarnings("unused") private static final LoggerHandler logger = new LoggerHandler(CharacterLiteralImpl.class, columbus.java.asg.Constant.LoggerPropertyFile); protected EdgeList<Comment> _comments; protected Object position; protected boolean isCompilerGenerated; protected boolean isToolGenerated; protected int _type; protected char charValue; protected int formatString; public CharacterLiteralImpl(int id, Factory factory) { super(id, factory); position = new Range(factory.getStringTable()); } @Override public NodeKind getNodeKind() { return NodeKind.ndkCharacterLiteral; } @Override public Range getPosition() { return (Range)position; } @Override public void setPosition(Range _position) { if (factory.getStringTable() == _position.getStringTable()) position = _position; else position = new Range(factory.getStringTable(), _position); } @Override public boolean getIsCompilerGenerated() { return isCompilerGenerated; } @Override public boolean getIsToolGenerated() { return isToolGenerated; } @Override public void setIsCompilerGenerated(boolean _isCompilerGenerated) { isCompilerGenerated = _isCompilerGenerated; } @Override public void setIsToolGenerated(boolean _isToolGenerated) { isToolGenerated = _isToolGenerated; } @Override public char getCharValue() { return charValue; } @Override public String getFormatString() { return factory.getStringTable().get(formatString); } @Override public int getFormatStringKey() { return formatString; } @Override public void setCharValue(char _charValue) { charValue = _charValue; } @Override public void setFormatString(String _formatString) { formatString = factory.getStringTable().set(_formatString); } @Override public EdgeIterator<Comment> getCommentsIterator() { if (_comments == null) return EdgeList.<Comment>emptyList().iterator(); else return _comments.iterator(); } @Override public boolean getCommentsIsEmpty() { if (_comments == null) return true; else return _comments.isEmpty(); } @Override public int getCommentsSize() { if (_comments == null) return 0; else return _comments.size(); } @Override public void addComments(int _id) { if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkComment)) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_id); } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void addComments(Comment _node) { if (_comments == null) _comments = new EdgeList<Comment>(factory); _comments.add(_node); } @Override public Type getType() { if (_type == 0) return null; if (factory.getIsFiltered(_type)) return null; return (Type)factory.getRef(_type); } @Override public void setType(int _id) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); if (!factory.getExist(_id)) throw new JavaException(logger.formatMessage("ex.java.Node.No_end_point")); Base _node = factory.getRef(_id); if (Common.getIsBaseClassKind(_node.getNodeKind(), NodeKind.ndkType)) { _type = _id; } else { throw new JavaException(logger.formatMessage("ex.java.Node.Invalid","NodeKind", _node.getNodeKind() )); } } @Override public void setType(Type _node) { if (_type != 0) throw new JavaException(logger.formatMessage("ex.java.Node.The_previous_end_point","type" )); _type = _node.getId(); } // ---------- Accept methods for Visitor ---------- @Override public void accept(Visitor visitor) { visitor.visit(this, true); } @Override public void acceptEnd(Visitor visitor) { visitor.visitEnd(this, true); } // ---------- Save ---------- @Override public void save(IO io) { io.writeInt4(id); io.writeUShort2(getNodeKind().ordinal()); if (_comments != null) { EdgeIterator<Comment> it = getCommentsIterator(); while (it.hasNext()) { io.writeInt4(it.next().getId()); } } io.writeInt4(0); io.writeInt4(((Range)position).getPathKey()); io.writeInt4(((Range)position).getLine()); io.writeInt4(((Range)position).getCol()); io.writeInt4(((Range)position).getEndLine()); io.writeInt4(((Range)position).getEndCol()); io.writeInt4(((Range)position).getWideLine()); io.writeInt4(((Range)position).getWideCol()); io.writeInt4(((Range)position).getWideEndLine()); io.writeInt4(((Range)position).getWideEndCol()); { byte boolValues = 0; boolValues <<= 1; if (isCompilerGenerated) boolValues |= 1; boolValues <<= 1; if (isToolGenerated) boolValues |= 1; io.writeByte1(boolValues); } io.writeInt4(!factory.getIsFiltered(_type) ? _type : 0); io.writeChar2(charValue); io.writeInt4(formatString); } // ---------- Load ---------- @Override public void load(IO io) { int _id; _id = io.readInt4(); if (_id != 0) { _comments = new EdgeList<Comment>(factory); while (_id != 0) { _comments.add(_id); _id = io.readInt4(); } } ((Range)position).setPathKey(io.readInt4()); ((Range)position).setLine(io.readInt4()); ((Range)position).setCol(io.readInt4()); ((Range)position).setEndLine(io.readInt4()); ((Range)position).setEndCol(io.readInt4()); ((Range)position).setWideLine(io.readInt4()); ((Range)position).setWideCol(io.readInt4()); ((Range)position).setWideEndLine(io.readInt4()); ((Range)position).setWideEndCol(io.readInt4()); { byte boolValues = io.readByte1(); isToolGenerated = (boolValues & 1) != 0; boolValues >>>= 1; isCompilerGenerated = (boolValues & 1) != 0; boolValues >>>= 1; } _type = io.readInt4(); charValue = io.readChar2(); formatString = io.readInt4(); } }
7,296
23.162252
138
java