private void init(Interface intf) throws IOException { if (intf == null || intf.getNumEndpoints() != 2) throw new IllegalArgumentException(); // XXX presumably this handles the "multiple devfs claims" case; check. intf.claim(); this.intf = intf; try { for (int i = 0; i < intf.getNumEndpoints(); i++) { Endpoint ep = intf.getEndpoint(i); if (!"bulk".equals(ep.getType())) throw new IllegalArgumentException(); if (ep.isInput()) in = ep.getInputStream(); else out = ep.getOutputStream(); } if (in == null || out == null) throw new IllegalArgumentException(); } catch (IOException e) { try { close(); } catch (Exception x) { intf = null; } throw e; } catch (RuntimeException e) { try { close(); } catch (Exception x) { intf = null; } throw e; } }
@SuppressWarnings("unchecked") public Object start( final String uri, final String localName, final Attributes attrs, final ExtensibleXmlParser parser) throws SAXException { parser.startElementBuilder(localName, attrs); String id = attrs.getValue("id"); String name = attrs.getValue("name"); String implRef = attrs.getValue("implementationRef"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); List<Interface> interfaces = (List<Interface>) buildData.getMetaData("Interfaces"); if (interfaces == null) { interfaces = new ArrayList<Interface>(); buildData.setMetaData("Interfaces", interfaces); } Interface i = new Interface(id, name); if (implRef != null) { i.setImplementationRef(implRef); } interfaces.add(i); return i; }
public void showComposition(boolean tocsv, boolean toStdOut) { Iterator<Table> tableIterator = this.getAssignedTables().iterator(); while (tableIterator.hasNext()) { Table moduleTable = tableIterator.next(); signalModuleTableCompositionLine(this.getName(), moduleTable.getName(), tocsv, toStdOut); } Iterator<Program> programIterator = this.getPrograms().iterator(); while (programIterator.hasNext()) { Program moduleProgram = programIterator.next(); signalModuleProgramCompositionLine( this.getName(), moduleProgram.getName(), moduleProgram.getPgmType(), tocsv, toStdOut); } Iterator<Interface> interfaceIterator = this.getInterfaces().iterator(); while (interfaceIterator.hasNext()) { Interface moduleInterface = interfaceIterator.next(); signalModuleInterfaceCompositionLine( this.getName(), moduleInterface.getName(), moduleInterface.getProgramName(), tocsv, toStdOut); } }
public static void main(String[] args) { Abstract ext = new Extend(); Interface i = new Extend(); ext.display(); i.displayTwice(); }
/** blendet Bild 'Gewonnen' ein Spieler erhaelt Erfahungspunkte */ public void sterben() { Interface.player[0].erfahrungspunkteSammeln(Spieler.ERHALTERFAHRUNGSPUNKTE); Spielfeld.wertSetzenBeiXY(Interface.getLevel(), Interface.getRaum(), x, y, Interface.SIEG); StdDraw.picture( Interface.PIC1 + Interface.PIC2 * x, Interface.PIC1 + Interface.PIC2 * y, Interface.SIEGIMG); }
/** * toString * * @return a {@link java.lang.String} object. */ public String toString() { StringBuffer str = new StringBuffer("Node Id = " + m_iface.getNodeId() + "\n"); str.append("IfIndex = " + m_iface.getIfIndex() + "\n"); str.append("Last Poll Time = " + m_lastPollTime + "\n"); str.append("Link Type Id = " + m_linktypeid + "\n"); str.append("Status= " + m_status + "\n"); return str.toString(); }
public void assignIP2SubNet(int index, String ipAddr) { Interface inf = interfaceMap.get(index); if (inf != null && inf.getSubnet() != null) { Subnet cws = inf.getSubnet(); if (cws.isValidate(ipAddr)) { cws.addActiveIp(ipAddr); } } }
public SvcRSubjectGuestAdd() { _defn = new Interface(); _defn.add( new Interface.Element( "id", CiteableIdType.DEFAULT, "The identity of the r-subject.", 1, 1)); _defn.add( new Interface.Element( "project", CiteableIdType.DEFAULT, "The project that has implicit access. If specified, all subject administrators in the project will be given administration rights for this subject.", 0, 1)); }
private static void printConfiguration(int indent, Configuration c) { String temp; // atypical: should always be able to read configuration if (c == null) { indentLine(indent, "<!-- null configuration -->"); return; } indentLine( indent, "<config value='" + c.getConfigurationValue() + "' total-length='" + c.getTotalLength() + "' attributes='" + Integer.toHexString(c.getAttributes()) + "'"); temp = c.getConfiguration(defaultLanguage); if (temp != null) indentLine(indent + 4, "description='" + temp + "'"); indentLine( indent + 4, "max-power='" + (2 * c.getMaxPower()) + " mA.' interfaces='" + c.getNumInterfaces() + "'>"); indent += 2; maybePrintDescriptors(indent, c.nextDescriptor()); for (int i = 0; i < c.getNumInterfaces(); i++) { try { Interface intf; // NOTE: assumes altsetting range is contiguous, [0..N] for (int j = 0; (intf = c.getInterface(i, j)) != null; j++) { // claimer of interface selects altsettings if (j == 0) { String claimer = intf.getClaimer(); if (claimer != null) indentLine( indent, "<!-- interface " + i + " is claimed by: " + claimer + " driver -->"); else indentLine(indent, "<!-- interface " + i + " is unclaimed -->"); } printInterface(indent, intf); } } catch (IOException e) { indentLine(indent, "<!-- CAN'T GET INTERFACE: "); e.printStackTrace(System.out); indentLine(indent, "-->"); } } indentLine(indent, "</config>"); }
public void assignLink() { for (Link link : linkMap.values()) { Integer srcIfIndex = link.getSrcIfIndex(); Integer dstIfIndex = link.getDstIfIndex(); Integer dstRouter = link.getDstRouterID(); if (srcIfIndex != null && dstIfIndex != null && dstRouter != null) { Interface inf = interfaceMap.get(srcIfIndex); if (inf != null) { inf.setLink(link); inf.setConType(1); } } } }
public static void drawInterfaces(float partial) { avr scaledresolution = new avr(XaeroMinimap.mc); int width = scaledresolution.a(); int height = scaledresolution.b(); int scale = scaledresolution.e(); int mouseX = Mouse.getX() * width / XaeroMinimap.mc.d; int mouseY = height - Mouse.getY() * height / XaeroMinimap.mc.e - 1; updateInterfaces(mouseX, mouseY, width, height, scale); for (Interface l : list) { if (XaeroMinimap.settings.getBooleanValue(l.option)) { l.drawInterface(width, height, scale, partial); } } }
public static void handlerDialog(int event) { if (event == EVENTBROWSE) { String path = dialog.openFileDialog(); document = XMLHandler.openDocument(path); dialog.pathField.setText(path); } if (event == EVENTEXECUTE) { if (document != null) { profiler.execute(document); String path = dialog.saveFileDialog(); XMLHandler.saveDocument(path, document); } dialog.pathField.setText("Write a valid path"); } if (event == EXIT) System.exit(0); }
// we define the method for getting a video link when pressing enter public String getvidlink() { try { System.setSecurityManager(new SecurityManager()); ipadd = tfIP.getText(); Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid"); // Get the String entered into the TextField tfInput, convert to int link = tfInput.getText(); vlink = client.getvid(link); } catch (Exception e) { System.out.println("[System] Server failed: " + e); } return vlink; }
private void addUserDefinedMethods(TopLevelClass exampleClass, Interface mapperClass, IntrospectedTable introspectedTable, MyBatisClasses cls) { for (Method action : mapperClass.getMethods()) { if (!userDefinedMethods.matcher(action.getName()).matches()) continue; StringBuilder args = new StringBuilder(); List<Parameter> params = new ArrayList<Parameter>(); boolean example = false; if (action.getParameters() != null) for (Parameter param : action.getParameters()) { String name; if (Objects.equals(param.getType(), exampleClass.getType())) { example = true; name = "this"; } else { name = param.getName(); params.add(new Parameter(param.getType(), name)); } if (args.length() > 0) args.append(", "); args.append(name); } if (!example) { //System.err.println("Invalid user-defined mapper method: "+action.getName()); continue; } exampleClass.addMethod(method( PUBLIC, INT, action.getName(), _(sqlSession, "sql"), params.toArray(new Parameter[params.size()]), __( "return sql.getMapper(" + cls.names.mapper + ".class)."+action.getName()+"("+args+");" ))); exampleClass.addMethod(method( PUBLIC, INT, action.getName(), _(cls.types.mapper, "mapper"), params.toArray(new Parameter[params.size()]), __( "return mapper."+action.getName()+"("+args+");" ))); } }
/** * The 'closes' the rrd file. This is where the actual work of writing the RRD files takes place. * The passed in rrd is actually an rrd command string containing updates. This method executes * this command. * * @param rrd a {@link java.lang.StringBuffer} object. * @throws java.lang.Exception if any. */ @Override public void closeFile(StringBuffer rrd) throws Exception { String command = rrd.toString(); String[] results = Interface.launch(command); if (results[0] != null) { throw new Exception(results[0]); } }
public SvcSubjectDecrypt() { _defn = new Interface(); _defn.add( new Interface.Element( "id", CiteableIdType.DEFAULT, "The citable identifier of the local parent Project or individual Subject. If none given, all Subjects in all Projects will be decrypted.", 0, 1)); _defn.add( new Interface.Element( "doctype", StringType.DEFAULT, "The name of a specific document type to be encrypted. If none given, will try to decrypt all documents in the private element.", 0, Integer.MAX_VALUE)); }
/** * 获取路由器上的IP地址表信息 * * @return */ public boolean updateAddress() { ipToIndexMap = new HashMap<String, Integer>(); List<Object[]> ipList = SNMPUtil.getIpAddrTable(adminIP); if (ipList != null) { for (Object[] item : ipList) { String addr = (String) item[0]; int ifIndex = (Integer) item[1]; String netMask = (String) item[2]; // 将信息补充到接口中,并建立根据IP索引的MAP Interface inf = interfaceMap.get(ifIndex); if (inf != null) { inf.setIpAddress(addr); inf.setNetMask(netMask); ipToIndexMap.put(addr, ifIndex); } } } return true; }
/** * Parses an interface type definition * * @param docClass * @return */ protected static Interface ParseInterface(ClassDoc docClass) { assert (docClass != null); Interface xmlInterface = new Interface(); xmlInterface.name = docClass.name(); xmlInterface.qualifiedName = docClass.qualifiedName(); xmlInterface.comment = docClass.commentText(); xmlInterface.isIncluded = docClass.isIncluded(); xmlInterface.scope = DetermineScope(docClass); xmlInterface.typeVariables = ParseTypeVariables(docClass.typeParameters(), docClass.typeParamTags()); Type[] interfaces = docClass.interfaceTypes(); ArrayList<String> interfaceTypeNames = new ArrayList<String>(); if (interfaces != null && interfaces.length > 0) { for (Type interfaceType : interfaces) { interfaceTypeNames.add(interfaceType.qualifiedTypeName()); } xmlInterface.interfaces = interfaceTypeNames.toArray(new String[] {}); } MethodDoc[] methods = docClass.methods(); if (methods != null && methods.length > 0) { ArrayList<Method> methodList = new ArrayList<Method>(); for (MethodDoc method : methods) { methodList.add(ParseMethod(method)); } xmlInterface.methods = methodList.toArray(new Method[] {}); } else { log.debug("No methods in interface: " + docClass.name()); } xmlInterface.annotationInstances = ParseAnnotationInstances(docClass.annotations(), docClass.qualifiedName()); return xmlInterface; }
public boolean scrollToItem(Item i) { Interface bankInterface = botEnv.interfaces.getInterface(Bank.BANK_INTERFACE_ID); IComponent itemContainer = bankInterface.getComponent(Bank.BANK_ITEM_PANE_ID); if (!i.container.isElementVisible()) { bankInterface.getComponent(62).doClick(); sleep(500, 1000); } /*if (bankInterface.getComponent(61).getTextureID() != 1419 && (itemContainer.getBounds().getLocation().equals(i.getBounds().getLocation()) || i.container.getRelativeX() == 0 && i.container.getRelativeY() == 0)) { bankInterface.getComponent(62).doClick(); sleep(500, 1000); } */ if (itemContainer.getBounds().contains(i.getCenter())) { return true; } IComponent arrow; if (i.getCenter().getY() < itemContainer.getAbsoluteY()) { arrow = bankInterface.getComponent(114).getChildren()[4]; } else { arrow = bankInterface.getComponent(114).getChildren()[5]; } Point p = botEnv.mouse.getMousePos(); if (!arrow.getBounds().contains(p)) { botEnv.mouse.moveMouse(arrow.getBounds()); } EventFactory eventFactory = new EventFactory(botEnv); p = botEnv.mouse.getMousePos(); MouseEvent mouseEvent = eventFactory.createMousePress(p.x, p.y, true); botEnv.dispatchEvent(mouseEvent); KTimer timeout = new KTimer(random(5000, 6000)); while (!itemContainer.getBounds().contains(i.getCenter()) && !timeout.isDone()) { sleep(200, 500); } mouseEvent = eventFactory.createMouseRelease(p.x, p.y, true); botEnv.dispatchEvent(mouseEvent); mouseEvent = eventFactory.createMouseClicked(p.x, p.y, true); botEnv.dispatchEvent(mouseEvent); return itemContainer.getBounds().contains(i.getCenter()); }
// we define the method for downloading when pressing on the download button public void qrvidlink() { try { System.setSecurityManager(new SecurityManager()); ipadd = tfIP.getText(); Interface client = (Interface) Naming.lookup("rmi://" + ipadd + "/getvid"); // Get the String entered into the TextField tfInput, convert to int link = tfInput.getText(); vlink = client.getvid(link); // here we receive the image serialized into bytes from the server and // saved it on the client as png image byte[] bytimg = client.qrvid(vlink); BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytimg)); File outputfile = new File("qrcode.png"); ImageIO.write(img, "png", outputfile); // img= new ImageIcon(bytimg.toByteArray()); } catch (Exception e) { System.out.println("[System] Server failed: " + e); } }
/** * Gets an item array of all the bank items. * * @return Array of bank items. */ public Item[] getItems() { Interfaces interfaces = botEnv.interfaces; Interface inventoryInterface = interfaces.getInterface(BANK_INTERFACE_ID); if (inventoryInterface == null) { return new Item[0]; } IComponent inventoryPane = inventoryInterface.getComponent(BANK_ITEM_PANE_ID); IComponent[] children = inventoryPane.getChildren(); if (children == null || children.length == 0) { return new Item[0]; } List<Item> items = new ArrayList<Item>(); for (IComponent aChildren : children) { if (aChildren == null) { continue; } Item item = new Item(botEnv, aChildren); if (item.getID() == -1) { continue; } items.add(item); } return items.toArray(new Item[items.size()]); }
/** * Write the xml for a {@link Interface}. * * @param interf * @param contentHandler * @throws SAXException */ protected static void generateXML(Interface interf, ContentHandler contentHandler) throws SAXException { final AttributesImpl ai = new AttributesImpl(); IOUtils.addAttribute(ai, "interface", interf.getInterfacename()); IOUtils.indent(contentHandler, 3); contentHandler.startElement( INNER_NAMESPACE_URI, ComponentDescriptorIO.INTERFACE, ComponentDescriptorIO.INTERFACE_QNAME, ai); contentHandler.endElement( INNER_NAMESPACE_URI, ComponentDescriptorIO.INTERFACE, ComponentDescriptorIO.INTERFACE_QNAME); IOUtils.newline(contentHandler); }
public static void cancel() { for (Interface l : list) { l.actualx = l.bx; l.actualy = l.by; l.centered = l.bcentered; l.flipped = l.bflipped; l.fromRight = l.bfromRight; } }
public static void applyPreset(int id) { for (Interface l : list) { actionTimer = 10; l.actualx = ((Preset)presets.get(id)).coords[l.id][0]; l.actualy = ((Preset)presets.get(id)).coords[l.id][1]; l.centered = ((Preset)presets.get(id)).types[l.id][0]; l.flipped = l.cflipped; l.fromRight = ((Preset)presets.get(id)).types[l.id][1]; } }
/** * Creates a the rrd file from the rrdDefinition. Since this definition is really just the create * command string it just executes it. * * @param createCommand a {@link java.lang.String} object. * @throws java.lang.Exception if any. */ @Override public void createFile(CreateCommand createCommand, Map<String, String> attributeMappings) throws Exception { if (createCommand == null) { LOG.debug("createRRD: skipping RRD file"); return; } LOG.debug("Executing: rrdtool {}", createCommand.toString()); Interface.launch(createCommand.toString()); String filenameWithoutExtension = createCommand.filename.replace(RrdUtils.getExtension(), ""); int lastIndexOfSeparator = filenameWithoutExtension.lastIndexOf(File.separator); RrdUtils.createMetaDataFile( filenameWithoutExtension.substring(0, lastIndexOfSeparator), filenameWithoutExtension.substring(lastIndexOfSeparator), attributeMappings); }
public static void main(String[] par) { Interface aI = new Interface(); double c = aI.askC(); int qtt = aI.askQtt(); int cont = 0; for (int i = 1; i <= qtt; i++) { Aluno a = aI.createAluno(); aI.displayA(a, c); if (a.aprov(c)) { cont++; } } aI.showAp(cont); }
public SvcSample() { _defn = new Interface(); _defn.add( new Interface.Element( "cid", CiteableIdType.DEFAULT, "The citeable identifier of the object.", 1, 1)); }
public static void main(String[] args) { Interface intFace = new Interface(); // initalise task intFace.run(); // Engage }
public void write(String ss) { i.test2(ss); }
public void displayItems(ItemQuery currentItem) { i.displayItems(currentItem); }