id
stringlengths
36
36
text
stringlengths
1
1.25M
7de1c840-ea00-4d2f-8a73-877b329b1329
public void draw(Graphics2D g){ for(int i = 0 ; i < objects.size(); i++) objects.get(i).draw(g); }
8289402a-2b2b-4adb-b71a-e13fbc3e7013
public void update(){ for(int i = 0; i < objects.size(); i++){ objects.get(i).update(); } }
96333c75-2db4-48d1-a5a6-22ecb6bfe28f
public void addObject(WinObject obj){ tmp_objects.add(obj); }
a93c8216-db0b-42fd-bfb2-6378283ac8a4
public void removeObject(int id){ tmp_objects.remove(id); }
e6139808-c182-4bfa-af3f-293a6484ac79
public void orderlist(){ for(int i = 0 ; i < tmp_objects.size() ; i++){ WinObject min = tmp_objects.get(i); for(int j = i; j < tmp_objects.size(); j++) if(min.size > tmp_objects.get(j).size){ min = tmp_objects.get(j); tmp_objects.set(j, tmp_objects.get(i)) ; tmp_objects.set(i, min); ...
1de8bd12-8ea8-4ea6-81a6-53f02ee0727a
public WinObject(int x, int y, int width, int height){ this.x = x; this.y = y; this.width = width; this.height = height; }
56bd6b08-ce18-44bf-91b3-f328b26f06b4
public abstract void update();
0881c101-d736-4ab4-b452-aaaaf5a22dfc
public abstract void draw(Graphics2D g);
3424a9ba-a26b-42c2-8826-5e3cf082b62a
public void setxVel(int vel){ this.xVel = vel; }
b54e35f4-0e2a-4d2f-a755-c2aaab1ecc6f
public void setyVel(int vel){ this.yVel = vel; }
21bb41e5-5956-40ac-910d-d5f14495c955
public abstract boolean isOut();
95a5e3ee-1fa2-45ac-a5e7-477bf7e92324
public Tiplets(int x, int y, int width, int height){ super(x,y,width,height); rand = new Random(); randSpeed(); }
3319f496-4a90-40f1-85e1-f781c7f6943d
public void draw(Graphics2D g){ switch(size){ case 0: g.setColor(new Color(0xFF4545)); break; case 1: g.setColor(new Color(0xaa5555)); break; case 2: g.setColor(Color.red); break; default: g.setColor(Color.yellow); break; } int[] px = {x , x + width, x + width }; int[] py = {y ...
2902f55f-334e-4309-ac6a-060bc15917d5
public void randSpeed(){ if(width > 25){ STARTING_SPEED = 1; size = 2; } if(width > 20 && width <= 25){ STARTING_SPEED = 2; size = 1; } if(width <= 20){ STARTING_SPEED = 4; size = 0; } setyVel(STARTING_SPEED + rand.nextInt(4)); }
435ad18e-13d0-417a-99b4-998127691539
public void update(){ if(x + xVel > WinCanvas.WIDTH * WinCanvas.SCALE+ width|| x + xVel < 0 - width) outOfBounds = true; this.x += xVel; if(y + yVel > WinCanvas.HEIGHT * WinCanvas.SCALE+ height|| y + yVel < 0 - width) outOfBounds = true; this.y += yVel; if(outOfBounds){ y = -width; x = rand.nextInt(W...
7d92627f-afe3-48ce-a15c-e94ab2b0cbb5
public boolean isOut(){ return outOfBounds; }
2238c10a-64a3-4a77-9775-4084fb67c927
@Before public void setUp() throws Exception { input = "NFDM00000001;94D690C0efefcbcbff33C7E810CD22A367B3D32B\n" + "NFDM00000002;efefcb94D690C0cbff33C7E810CD22A367B3D32B"; }
6b08acf1-49ca-42bd-af83-3c9e594e5300
@Test public void test() throws Exception { Commons.getInstance().stringToFile(input, "/tmp/testInput.txt"); List<String> lst = Commons.getInstance().getListStringFromFile("/tmp/testInput.txt"); KeyContainer kc = new KeyContainer(); List<KeyPackage> keyPackageList = new ArrayList<KeyPackage>(); Algorit...
33f9122c-7afb-4bff-b3ed-714420530cfe
public static Controller getInstance(){ if(INSTANCE == null) INSTANCE = new Controller(); return INSTANCE; }
a037bbfa-0119-46bf-85df-3b64bce27001
private Controller(){}
f6b18437-23fd-4f89-9ca6-4fb7aa6ee784
public int buildPskc(String inputFilePath, String outputFilePath, String manufact, String colSep, String respLen, String counter, String interval, int algoType) throws Exception{ List<String> lst = Commons.getInstance().getListStringFromFile(inputFilePath); KeyContainer kc = new KeyContainer(); List<KeyPackag...
6e1bdc00-6eec-4258-9e13-9a5ce325b315
public String getPlainValue() { return plainValue; }
8b6e93aa-29c5-435b-a9ea-82d9e4c58bea
public void setPlainValue(String plainValue) { this.plainValue = plainValue; }
1aaad4cc-88ab-41d6-98a5-db540ae94929
public Secret(String plainValue) { super(); this.plainValue = plainValue; }
b87711b6-05ea-4c4c-b165-3a11a34f9790
public AlgorithmParameters getAlgorithmParameters() { return algorithmParameters; }
d8555c38-9674-4672-94bb-f866a3f685a5
public void setAlgorithmParameters(AlgorithmParameters algorithmParameters) { this.algorithmParameters = algorithmParameters; }
c65cc8c6-fed1-4710-8dc2-057cbdf7a902
public String getId() { return id; }
ce4f9dec-7a97-4fec-ab99-5220a244c641
public void setId(String id) { this.id = id; }
175c5fc4-bec0-49e6-821d-8575d7bf0f30
public String getAlgorithm() { return algorithm; }
beca14d1-8ccf-416f-8efa-420b7f9fe82d
public void setAlgorithm(String algorithm) { this.algorithm = algorithm; }
bd9801c2-a85b-4d67-a9a7-fb1334054c3c
public String getIssuer() { return issuer; }
8a07d960-320b-4269-a8ad-4492ba032d2d
public void setIssuer(String issuer) { this.issuer = issuer; }
49249f32-e068-47af-a4a2-9c33462e5b5f
public Data getData() { return data; }
6280d86b-92bb-4dca-8aac-8b7d2f0b2fba
public void setData(Data data) { this.data = data; }
eb866aed-f3bc-407e-bb9f-7079bcbd0ded
public Key(String id, String algorithm, String issuer, Data data, AlgorithmParameters algorithmParameters) { super(); this.id = id; this.algorithm = algorithm; this.issuer = issuer; this.data = data; this.algorithmParameters = algorithmParameters; }
8a1e74fe-f2fa-4db5-bb2b-1efdb37837dc
public List<KeyPackage> getKeyPackageList() { return keyPackageList; }
5b5543cc-dfa2-43a1-af6c-b90ba4c313ea
public void setKeyPackageList(List<KeyPackage> keyPackageList) { this.keyPackageList = keyPackageList; }
3ef663d3-7c86-452e-a96b-0a06ced72e1d
public int getAlgoType() { return algoType; }
46df2ff7-72dc-45c1-99a5-85c4b3db9ff3
public void setAlgoType(int algoType) { this.algoType = algoType; }
34588130-37fa-47b5-b89e-f5e99396227e
public ResponseFormat getResponseFormat() { return responseFormat; }
303f34c8-b444-42a2-a676-79b4362df844
public void setResponseFormat(ResponseFormat responseFormat) { this.responseFormat = responseFormat; }
8df4c2fa-5241-48a4-b224-d2edcc57603f
public AlgorithmParameters(ResponseFormat responseFormat, int algoType) { super(); this.responseFormat = responseFormat; this.algoType = algoType; }
7ccb292f-c686-4016-92fa-af8bcf39d105
public String getManufacturer() { return manufacturer; }
9b121c48-dea6-43f8-9f8b-81e09fc6312d
public void setManufacturer(String manufacturer) { this.manufacturer = manufacturer; }
64a1d7c5-5e7f-45e0-85a2-e2f9a03d37d7
public String getSerialNo() { return serialNo; }
fa15ee6f-402e-4f50-9a36-ef492606f4e9
public void setSerialNo(String serialNo) { this.serialNo = serialNo; }
65ef2520-a14a-4e5c-9515-42c6d15f3fab
public DeviceInfo(String manufacturer, String serialNo) { super(); this.manufacturer = manufacturer; this.serialNo = serialNo; }
71bfece4-54bc-4ad3-84a9-327b40d14bdc
public String getLength() { return length; }
22ec47d7-1583-416f-a29b-00a3fd036a33
public void setLength(String length) { this.length = length; }
5b21aa98-5f3b-4365-b11c-c3be14b0c4e0
public String getEncoding() { return encoding; }
834d4e9a-df9a-4331-973e-4ace0ea039ce
public void setEncoding(String encoding) { this.encoding = encoding; }
73f14dbf-95fd-47ea-bed9-4627a950f2ee
public ResponseFormat(String length, String encoding) { super(); this.length = length; this.encoding = encoding; }
ab98cae0-7e11-4825-bba2-db9d5b5674d7
public DeviceInfo getDeviceInfo() { return deviceInfo; }
15b88e6f-114b-4b69-b62d-6e5908dac67c
public void setDeviceInfo(DeviceInfo deviceInfo) { this.deviceInfo = deviceInfo; }
85742d3d-aed3-4b45-a7e9-b635f803f14c
public Key getKey() { return key; }
cd31c272-cb95-4517-b957-bd0f29f29d37
public void setKey(Key key) { this.key = key; }
c7cf84ff-733a-4843-b33a-c1467c6bdeb7
public KeyPackage(DeviceInfo deviceInfo, Key key) { super(); this.deviceInfo = deviceInfo; this.key = key; }
79b6a267-db92-48ec-a33f-9e7853a517f0
public String getCounter() { return counter; }
778c9b63-33d5-4ab3-90ae-d47151920e49
public void setCounter(String counter) { this.counter = counter; }
54b30224-173d-46fd-bd90-ec2f9bbf9c98
public String getTimeInterval() { return timeInterval; }
a81c3eb9-c59a-46bd-aa8f-87c5b576db3a
public void setTimeInterval(String timeInterval) { this.timeInterval = timeInterval; }
10e5cbac-be49-4c78-b7ab-2a08115f9baa
public Secret getSecret() { return secret; }
f81104a7-4e42-427f-a488-07eb6408c78c
public void setSecret(Secret secret) { this.secret = secret; }
a18ee14d-8681-43a8-9d59-792024b6b42a
public Data(Secret secret, String timeInterval, String counter) { super(); this.secret = secret; this.timeInterval = timeInterval; this.counter = counter; }
fa46a43c-e797-46c3-a98d-b730c6e4ab25
public static XmlUtils getInstance(){ if(INSTANCE == null) INSTANCE = new XmlUtils(); return INSTANCE; }
2489e224-032c-487b-b725-bd8eee322ac9
private XmlUtils(){}
311ebc49-cca1-4edf-b3cb-550530f60d36
public boolean isDocValid(String xml) { boolean ret = true; SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); File schemaLocation = new File(Constants.XSD_PATH); if(schemaLocation.exists()){ Schema schema = null; try { schema = factory.newSchema(schemaLocation); ...
b4849a74-fc36-463c-a60e-99213111b9f1
public String Obj2XmlStr(KeyContainer kc) { StringBuffer sb = new StringBuffer(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); sb.append("<KeyContainer Version=\"1.0\" xmlns=\"urn:ietf:params:xml:ns:keyprov:pskc\">\n"); for (int i = 0; i < kc.getKeyPackageList().size(); i++) { sb.a...
f5a475c1-b1a4-421f-81a7-4409e1bb11ce
public static Commons getInstance(){ if(INSTANCE == null) INSTANCE = new Commons(); return INSTANCE; }
d5b5771c-e007-4d7b-9b53-bf943b41bd9a
private Commons(){}
640f2d92-eb17-48a2-8291-d1fbe9bc8ce2
public String byteArrayToHexString(byte[] raw) throws UnsupportedEncodingException { final byte[] HEX_CHAR_TABLE = { (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f' }; ...
5bccc200-abec-4425-a294-71b5c8d2dbd7
public byte[] hexStringToByteArray(String s) throws Exception { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); return data; }
af77227a-cf5e-4386-9719-45709f5cbbb4
public void stringToFile(String content, String strFilePath) throws IOException { BufferedWriter out = new BufferedWriter(new FileWriter(strFilePath)); out.write(content); out.close(); }
cfefe56f-22e2-4ba2-a92c-8a545619a439
public String getStringFromFile(String filePath) throws IOException { StringBuffer ret = new StringBuffer(); BufferedReader in = new BufferedReader(new FileReader(filePath)); String str; while ((str = in.readLine()) != null) { ret.append(str+"\n"); } in.close(); return ret.toString(); }
e0339938-58bc-4e72-8f4b-e9392f8358b0
public List<String> getListStringFromFile(String filePath) throws IOException { List<String> ret = new ArrayList<String>(); BufferedReader in = new BufferedReader(new FileReader(filePath)); String str; while ((str = in.readLine()) != null) ret.add(str); in.close(); return ret; }
5a749963-0762-4db3-8fe9-cfbbdc198269
public void addComponentToPane(Container pane) { dc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); separatorLabel = new JLabel("Column"); respLenLabel = new JLabel("Resp. Length "); respLenLabel.setBounds(4, 186, 100, 26); respLen = new JTextField(); respLen.setText("6"); respLen.setBounds(4+88, ...
50dfadb1-7baa-4bfe-891d-1d87e15c395a
public void itemStateChanged(ItemEvent evt) { CardLayout cl = (CardLayout)(cards.getLayout()); cl.show(cards, (String)evt.getItem()); }
308da4af-154f-42df-81c3-379b5e33f5d6
private static void createAndShowGUI() { JFrame frame = new JFrame(Constants.APP_NAME+" - "+Constants.APP_VERSION); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Builder gui = new Builder(); gui.addComponentToPane(frame.getContentPane()); ImageIcon icon = new ImageIcon("./resources/logo.png"); f...
52b1d012-3d73-4038-8b59-32b48437d160
public static void main(String[] args) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); } catch (UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } catch (IllegalAccessException ex) { ex.printStackTrace(); } catch (InstantiationException ex) { ex.printStackTra...
1b040535-92b9-4f43-8bc1-626d730ee94a
public void run() { createAndShowGUI(); }
7bb39767-7685-42df-9566-6eefb2d351bf
@Override public void actionPerformed(ActionEvent e) { console.setForeground(Color.GREEN); if(e.getSource() == inputButton){ int returnVal = fc.showOpenDialog(cards); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); input = file.getAbsolutePath(); console.append("...
c2d0e53c-f0bb-416f-a175-f781f31a9c18
@Override public Void doInBackground() { while (!done) { if(input!=null){ try { int tokensImported = Controller.getInstance().buildPskc(input, output, manufacturer.getText(),separator.getText(), respLen.getText(), counter.getText(), interval.getText(), algoType.getSelectedIndex()); conso...
33de725b-a0e9-42ba-8260-87b1baf0f641
@Override public void done() { Toolkit.getDefaultToolkit().beep(); done = true; setControls(done); }
7b722d30-a543-4ad3-a0c4-684d53a666f6
@Override public void propertyChange(PropertyChangeEvent arg0) { if (!done){ progressBar.setString("running..."); progressBar.setIndeterminate(true); } else { progressBar.setIndeterminate(false); done = false; } }
4bdca309-e61a-4cc5-b80a-d720e487554a
public void setControls(boolean enable){ // buttons inputButton.setEnabled(enable); outputButton.setEnabled(enable); executeButton.setEnabled(enable); // fields algoType.setEnabled(enable); separator.setEnabled(enable); counter.setEnabled(enable); interval.setEnabled(enable); manufacturer.setEnabl...
fcc6ace7-13fb-476b-8fcc-7d332436344f
public void treeNodesChanged(TreeModelEvent e) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) (e.getTreePath().getLastPathComponent()); LOGGER.debug("treeNodesChanged called on TreeModelEvent " + e); /* * If the event lists children, then the changed node is the child of * the node we've already ...
47326a01-2f9f-4d6d-bd64-edc96405a2e4
public void treeNodesInserted(TreeModelEvent e) { LOGGER.debug("treeNodesInserted called on TreeModelEvent " + e); }
09143faa-b85e-4ab5-920f-afad82694707
public void treeNodesRemoved(TreeModelEvent e) { LOGGER.debug("treeNodesRemoved called on TreeModelEvent " + e); }
09ddcb0e-df01-4f62-b3c3-fbc5e39b0376
public void treeStructureChanged(TreeModelEvent e) { LOGGER.debug("treeStructureChanged called on TreeModelEvent " + e); }
bb886d0b-a77c-4cd1-9c0a-641f922e3ef7
public DynamicTreePanel(DefaultMutableTreeNode rootNode) { super(new GridLayout(1, 0)); this.rootNode = rootNode; treeModel = new DefaultTreeModel(rootNode); treeModel.addTreeModelListener(new MyTreeModelListener()); tree = new JTree(treeModel); tree.setEditable(true); tree.getSelectionModel().setSelecti...
214889a6-48ff-47ff-b30f-49f467e0ca90
public void clear() { rootNode.removeAllChildren(); treeModel.reload(); }
b7b2a2cf-e921-44e6-b899-43144215f1bb
public void removeNode(DefaultMutableTreeNode node) { MutableTreeNode parent = (MutableTreeNode) (node.getParent()); if (parent != null) { treeModel.removeNodeFromParent(node); } }
15ffb6ec-ef0b-4a93-a031-2bc62caa9526
public void removeCurrentNode() { TreePath currentSelection = tree.getSelectionPath(); if (currentSelection != null) { DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) (currentSelection.getLastPathComponent()); MutableTreeNode parent = (MutableTreeNode) (currentNode.getParent()); if (parent !=...
7e15906f-6225-4545-a036-87f48dd05c91
public DefaultMutableTreeNode addObjectAtCurrentNode(Object child) { DefaultMutableTreeNode parentNode = null; TreePath parentPath = tree.getSelectionPath(); if (parentPath == null) { parentNode = rootNode; } else { parentNode = (DefaultMutableTreeNode) (parentPath.getLastPathComponent()); } return ...
c5761253-0cea-415a-ba25-ec7ff93f7588
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child) { return addObject(parent, child, false); }
d856dc29-e2bd-4244-91f0-24d2ba4e5fef
public DefaultMutableTreeNode addObject(DefaultMutableTreeNode parent, Object child, boolean shouldBeVisible) { DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); if (parent == null) { parent = rootNode; } // It is key to invoke this on the TreeModel, and NOT // DefaultMutableTreeNode ...
50b42318-1980-4380-bd3e-89076e729f0e
private static void createAndShowGUI() { // Create and set up the window. JFrame frame = new JFrame("DynamicTreeDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode("Root Node"); // Create the components. DynamicTreePanel dynamicTree = ...
76d37094-a41d-4d12-8e54-47f0f2d883c9
public static void main(String[] args) { // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI. SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }
2681bc51-b459-4e4b-9fb5-dc1f522bf19d
public void run() { createAndShowGUI(); }
fb5dc279-2946-4967-8a54-b06e70044021
TreePopulatorInstant(){ super(); }