View Javadoc
1   /*
2    * Copyright 2020-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.hardware.common;
6   
7   import oshi.annotation.concurrent.Immutable;
8   import oshi.hardware.GraphicsCard;
9   
10  /**
11   * An abstract Sound Card
12   */
13  @Immutable
14  public abstract class AbstractGraphicsCard implements GraphicsCard {
15  
16      private final String name;
17      private final String deviceId;
18      private final String vendor;
19      private final String versionInfo;
20      private long vram;
21  
22      /**
23       * Constructor for AbstractGraphicsCard
24       *
25       * @param name        The name
26       * @param deviceId    The device ID
27       * @param vendor      The vendor
28       * @param versionInfo The version info
29       * @param vram        The VRAM
30       */
31      protected AbstractGraphicsCard(String name, String deviceId, String vendor, String versionInfo, long vram) {
32          this.name = name;
33          this.deviceId = deviceId;
34          this.vendor = vendor;
35          this.versionInfo = versionInfo;
36          this.vram = vram;
37      }
38  
39      @Override
40      public String getName() {
41          return name;
42      }
43  
44      @Override
45      public String getDeviceId() {
46          return deviceId;
47      }
48  
49      @Override
50      public String getVendor() {
51          return vendor;
52      }
53  
54      @Override
55      public String getVersionInfo() {
56          return versionInfo;
57      }
58  
59      @Override
60      public long getVRam() {
61          return vram;
62      }
63  
64      @Override
65      public String toString() {
66          StringBuilder builder = new StringBuilder();
67          builder.append("GraphicsCard@");
68          builder.append(Integer.toHexString(hashCode()));
69          builder.append(" [name=");
70          builder.append(this.name);
71          builder.append(", deviceId=");
72          builder.append(this.deviceId);
73          builder.append(", vendor=");
74          builder.append(this.vendor);
75          builder.append(", vRam=");
76          builder.append(this.vram);
77          builder.append(", versionInfo=[");
78          builder.append(this.versionInfo);
79          builder.append("]]");
80          return builder.toString();
81      }
82  }