| 1 | /* ======================================================================== |
| 2 | * PlantUML : a free UML diagram generator |
| 3 | * ======================================================================== |
| 4 | * |
| 5 | * Project Info: http://plantuml.com |
| 6 | * |
| 7 | * If you like this project or if you find it useful, you can support us at: |
| 8 | * |
| 9 | * http://plantuml.com/patreon (only 1$ per month!) |
| 10 | * http://plantuml.com/paypal |
| 11 | * |
| 12 | * This file is part of Smetana. |
| 13 | * Smetana is a partial translation of Graphviz/Dot sources from C to Java. |
| 14 | * |
| 15 | * (C) Copyright 2009-2020, Arnaud Roques |
| 16 | * |
| 17 | * This translation is distributed under the same Licence as the original C program: |
| 18 | * |
| 19 | ************************************************************************* |
| 20 | * Copyright (c) 2011 AT&T Intellectual Property |
| 21 | * All rights reserved. This program and the accompanying materials |
| 22 | * are made available under the terms of the Eclipse Public License v1.0 |
| 23 | * which accompanies this distribution, and is available at |
| 24 | * http://www.eclipse.org/legal/epl-v10.html |
| 25 | * |
| 26 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 27 | ************************************************************************* |
| 28 | * |
| 29 | * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC |
| 30 | * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] |
| 31 | * |
| 32 | * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES |
| 33 | * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. |
| 34 | * |
| 35 | * You may obtain a copy of the License at |
| 36 | * |
| 37 | * http://www.eclipse.org/legal/epl-v10.html |
| 38 | * |
| 39 | * Unless required by applicable law or agreed to in writing, software |
| 40 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 41 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 42 | * See the License for the specific language governing permissions and |
| 43 | * limitations under the License. |
| 44 | * |
| 45 | */ |
| 46 | package h; |
| 47 | |
| 48 | import java.util.ArrayList; |
| 49 | import java.util.List; |
| 50 | |
| 51 | import smetana.core.HardcodedStruct; |
| 52 | import smetana.core.UnsupportedStructAndPtr; |
| 53 | import smetana.core.__ptr__; |
| 54 | import smetana.core.__struct__; |
| 55 | import smetana.core.amiga.StarStruct; |
| 56 | |
| 57 | public class ST_elist extends UnsupportedStructAndPtr implements HardcodedStruct { |
| 58 | |
| 59 | public int size; |
| 60 | public List<ST_Agedge_s> list; |
| 61 | |
| 62 | public ST_elist() { |
| 63 | this(null); |
| 64 | } |
| 65 | |
| 66 | public ST_elist(StarStruct parent) { |
| 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public void copyDataFrom(__struct__ other) { |
| 71 | ST_elist other2 = (ST_elist) other; |
| 72 | this.size = other2.size; |
| 73 | this.list = other2.list; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public void setStruct(__struct__ value) { |
| 78 | copyDataFrom(value); |
| 79 | } |
| 80 | |
| 81 | @Override |
| 82 | public void ___(__struct__ other) { |
| 83 | ST_elist other2 = (ST_elist) other; |
| 84 | this.size = other2.size; |
| 85 | this.list = other2.list; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public ST_elist copy() { |
| 90 | final ST_elist result = new ST_elist(); |
| 91 | result.size = this.size; |
| 92 | result.list = this.list; |
| 93 | return result; |
| 94 | } |
| 95 | |
| 96 | public boolean listNotNull() { |
| 97 | return list != null; |
| 98 | } |
| 99 | |
| 100 | public void mallocEmpty(int nb) { |
| 101 | list = new ArrayList<ST_Agedge_s>(); |
| 102 | while (list.size() < nb) { |
| 103 | list.add(null); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | |
| 108 | public void realloc(int nb) { |
| 109 | if (list == null) { |
| 110 | list = new ArrayList<ST_Agedge_s>(); |
| 111 | } |
| 112 | while (list.size() < nb) { |
| 113 | list.add(null); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | |
| 118 | public void free() { |
| 119 | list = null; |
| 120 | } |
| 121 | |
| 122 | public void setInList(int idx, Object value) { |
| 123 | list.set(idx, (ST_Agedge_s) value); |
| 124 | } |
| 125 | |
| 126 | public __ptr__ getFromList(int i) { |
| 127 | return (__ptr__) list.get(i); |
| 128 | } |
| 129 | |
| 130 | |
| 131 | // public static List<String> DEFINITION = Arrays.asList( |
| 132 | // "typedef struct elist", |
| 133 | // "{", |
| 134 | // "edge_t **list", |
| 135 | // "int size", |
| 136 | // "}", |
| 137 | // "elist"); |
| 138 | } |
| 139 | |
| 140 | // typedef struct elist { |
| 141 | // edge_t **list; |
| 142 | // int size; |
| 143 | // } elist; |