本文整理汇总了Java中org.snmp4j.smi.Gauge32类的典型用法代码示例。如果您正苦于以下问题:Java Gauge32类的具体用法?Java Gauge32怎么用?Java Gauge32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Gauge32类属于org.snmp4j.smi包,在下文中一共展示了Gauge32类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDataType
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
public static SNMPDataType getDataType(Variable var){
SNMPDataType retVal = SNMPDataType.INT;
/*
* org.snmp4j.smi.Variable implementations
* AbstractVariable, BitString,
* Counter32, Counter64, Gauge32, Integer32, UnsignedInteger32,
* TimeTicks,
* OctetString,
* GenericAddress, IpAddress, Null, OID, Opaque, SMIAddress, SshAddress, TcpAddress, TlsAddress,
* TransportIpAddress, TsmSecurityParameters, UdpAddress, VariantVariable
* SNMPDataType: STRING,INT,LONG,FLOAT,TICKS,OCTIN,OCTOUT,COUNT, OTHER
*/
if(var instanceof TimeTicks) {
retVal = SNMPDataType.TICKS;
} else if(var instanceof Counter64 || var instanceof Counter32) {
retVal = SNMPDataType.COUNT;
} else if(var instanceof Integer32 || var instanceof UnsignedInteger32) {
retVal = SNMPDataType.COUNT;
} else if(var instanceof Gauge32) {
retVal = SNMPDataType.COUNT;
} else if(var instanceof OctetString) {
retVal = SNMPDataType.STRING;
}
return retVal;
}
示例2: testModify
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
@Test
public void testModify() throws Exception {
final ModifierProperties modifierProperties = new ModifierProperties();
modifierProperties.put("minimum", 0);
modifierProperties.put("maximum", 3000);
modifierProperties.put("minimumStep", 1);
modifierProperties.put("maximumStep", 10);
final Gauge32Modifier modifier = new Gauge32Modifier();
modifier.init(modifierProperties);
final Gauge32 gauge32 = new Gauge32(0);
assertEquals(gauge32.getValue(), 0);
final Gauge32 modifiedVariable = modifier.modify(gauge32);
assertNotEquals(modifiedVariable.getValue(), 0);
}
示例3: generateRowData
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
private static Variable[] generateRowData(List<MyMibNode> columnNodes) {
Variable[] rowValues = new Variable[columnNodes.size()];
for (int i = 0; i < columnNodes.size(); i++) {
MyMibNode columnNode = columnNodes.get(i);
String rule = columnNode.getRule();
if("Counter32".equals(columnNode.getType())){
rowValues[i] = new Counter32(Long.parseLong("".equals(rule) ? TestDataUtil.parseInnerMethod("${randomInt(1, 512)}") : TestDataUtil.parseInnerMethod(rule)));
}
if("Gauge32".equals(columnNode.getType())){
rowValues[i] = new Gauge32(Long.parseLong("".equals(rule) ? TestDataUtil.parseInnerMethod("${randomInt(1, 512)}") : TestDataUtil.parseInnerMethod(rule)));
}
if("Integer32".equals(columnNode.getType()) || "INTEGER".equals(columnNode.getType())){
rowValues[i] = new Integer32(Integer.parseInt("".equals(rule) ? TestDataUtil.parseInnerMethod("${randomInt(1, 512)}") : TestDataUtil.parseInnerMethod(rule)));
}
if("TimeTicks".equals(columnNode.getType())){
rowValues[i] = new TimeTicks();
}
if("Unsigned32".equals(columnNode.getType())){
rowValues[i] = new Integer32(Integer.parseInt("".equals(rule) ? TestDataUtil.parseInnerMethod("${randomInt(1, 512)}") : TestDataUtil.parseInnerMethod(rule)));
}
if("IpAddress".equals(columnNode.getType())){
rowValues[i] = new IpAddress("10.10.10.10");
}
if("OCTET STRING".equals(columnNode.getType())){
rowValues[i] = new OctetString("".equals(rule) ? TestDataUtil.parseInnerMethod("${randomString(5)}") : TestDataUtil.parseInnerMethod(rule));
}
}
return rowValues;
}
示例4: castToLong
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
public static long castToLong(Variable variable) {
switch (variable.getSyntax()) {
case SMIConstants.SYNTAX_GAUGE32:
return ((Gauge32) variable).toLong();
case SMIConstants.SYNTAX_COUNTER32:
return ((Counter32) variable).toLong();
case SMIConstants.SYNTAX_COUNTER64:
return ((Counter64) variable).toLong();
case SMIConstants.SYNTAX_TIMETICKS:
return ((TimeTicks) variable).toLong();
default:
throw new IllegalArgumentException("Unsupported cast from "
+ variable.getSyntaxString() + " to long");
}
}
示例5: getGauge32
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
public SnmpValue getGauge32(long val) {
return new Snmp4JValue(new Gauge32(val));
}
示例6: cast
import org.snmp4j.smi.Gauge32; //导入依赖的package包/类
@Override
protected Gauge32 cast(long value) {
return new Gauge32(value);
}