method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4c1057e8-f604-44d1-ad16-4032e36a2850 | 8 | void finishDocument() throws IOException {
if (doVectors == false) {
return;
}
doVectors = false;
final int numPostings = bytesHash.size();
final BytesRef flushTerm = termsWriter.flushTerm;
assert numPostings >= 0;
// This is called once, after inverting all occurrences
// of ... |
c550ad84-54ba-4053-818b-cc153b2d106c | 3 | public void run(){
while (!m_isAborted){
boolean currentAction = m_isRising;
checkSwitches();
if(currentAction != m_isRising){
double speed = 0;
if(m_isRising){
speed = 1;
}els... |
05c5fd1e-0422-4f27-bccc-210903e161a4 | 4 | public SQLite(Logger log, String prefix, String name, String location) {
super(log, prefix, "[SQLite] ");
this.name = name;
this.location = location;
File folder = new File(this.location);
if (this.name.contains("/") || this.name.contains("\\") || this.name.endsWith(".db")) {
this.writeError("The database ... |
2f9ab185-bc3b-4262-a204-a70abb633ff7 | 6 | public final void makeroom(int nbefore, int nafter) {
if (value != null) {
LuaString s = value.strvalue();
value = null;
length = s.m_length;
offset = nbefore;
bytes = new byte[nbefore + length + nafter];
System.arraycopy(s.m_bytes, s.m_offset, bytes, offset, length);
} else if (offset + length + ... |
81b2d9a0-c720-4e04-9b62-8e875a5ee977 | 6 | public static XmlGlobalAttribute makeXmlGlobalAttributeInternal(String name, String namespaceName, String namespaceUri, String surfaceForm) {
if ((namespaceUri == null) ||
((namespaceName == null) ||
(Stella.stringEqlP(namespaceUri, "") ||
Stella.stringEqlP(namespaceName, "")))) {
t... |
cba16c02-4889-43fa-b386-5c2f7a1367e4 | 7 | private int findNearestPair(double key, double secondaryKey) {
int low = 0;
int high = m_CondValues.size();
int middle = 0;
while (low < high) {
middle = (low + high) / 2;
double current = ((Double)m_CondValues.elementAt(middle)).doubleValue();
if (current == key) {
double secon... |
856b4de3-7a38-44fb-961a-6cf82d7af2e0 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
7b692314-077d-4079-891e-5f09ca0243a3 | 7 | private void calculeRoof(){
boolean matrixAuxiliar[][] = new boolean[matrix_height][matrix_width];
int auxLen;
for(int row = 0; row < matrix_height; row++){
for(int col = 0; col < matrix_width; col++){
if(!matrixAuxiliar[row][col] && matrix[row][col]==1){
... |
d7856b76-20d2-4e45-ab41-2486372060bd | 1 | public int haeVuodentilaukset (int vuosi) throws DAOPoikkeus {
TilastointiDAO tilasto = new TilastointiDAO();
HashMap<Integer, Tilastointi> tilaustenlkm = tilasto.haeTilaukset(vuosi);
int vuodentilaukset = 0;
for (int i = 1; i < 13; i++) {
Tilastointi tilauksia = tilaustenlkm.get(i);
... |
0d596eed-afa6-4a57-8436-2ac220f79896 | 1 | public static int strdtoi(String decimal)
{
/*
* The basic set up for the next three methods is to basically check the value at a given index
* convert that character to its ASCII representation and subtract the appropriate value so that
* it matches correctly. When going through again, the sum is multipli... |
b1dfa637-8a92-474b-9a57-32d1366d358e | 3 | private void added (DeviceImpl dev)
{
// call synch'd on devices
for (int i = 0; i < listeners.size (); i++) {
USBListener listener;
listener = (USBListener) listeners.elementAt (i);
try {
listener.deviceAdded (dev);
} catch (Excepti... |
68cae35b-b0cb-4da3-bb09-26ad437dab7e | 9 | void drawVLine(int argb, boolean tScreened, int x, int y, int z, int h) {
// hover, labels only
int width = g3d.width;
int height = g3d.height;
if (h < 0) {
y += h;
h = -h;
}
int[] pbuf = g3d.pbuf;
int[] zbuf = g3d.zbuf;
if (y < 0) {
h += y;
y = 0;
}
if (y... |
21c860da-c258-4061-a3c3-fabd78800602 | 8 | public static void main(String[] args) {
TargetDataLine line = null;
Mixer mixer = null;
final AudioBuffer buffer = new AudioBuffer();
PeakListener peakListener = new PeakListener(buffer, 300,500);
//buffer.activateLowPassFilter(100);
//peakListener.addPeakHandler(new LetterDetector("letterData.txt", 1));
... |
a98252bc-f81e-4af6-a96e-8cd728dd08bf | 5 | public void addListener() {
itemtf[4].addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent arg0) {
if (!itemtf[4].getText().equals("")) {
String name = logic.showTeacherName(itemtf[4].getText());
itemtf[5].setText(name);
}
}
@Override
public void focusGai... |
5cbe29b8-7f19-4f11-8e69-23d6b034ee86 | 9 | private static String convertToneNumber2ToneMark(final String pinyinStr) {
String lowerCasePinyinStr = pinyinStr.toLowerCase();
if (lowerCasePinyinStr.matches("[a-z]*[1-5]?")) {
final char defautlCharValue = '$';
final int defautlIndexValue = -1;
char unmarkedVowel = defautlCharValue;
... |
d7564ecc-5847-4452-8049-501cbd2e0b00 | 1 | public boolean release(long id) {
if(weaponID == id) {
weaponID = NO_WEAPON;
return true;
}
return false;
} |
f9d0aa2d-2296-443b-9e86-2bf5cc59c2ff | 7 | private static int getServerCertificateFailures(X509Certificate cert, String realHostName) {
int mask = 8;
Date time = new Date(System.currentTimeMillis());
if (time.before(cert.getNotBefore())) {
mask |= 1;
}
if (time.after(cert.getNotAfter())) {
mask |= 2;
}
... |
67a07404-d8d5-4e2a-b57f-d5118db97bc0 | 0 | public String getSeatType() {
return this._seatType;
} |
6e77e7ad-a305-47d3-9d5f-a990bdef3189 | 7 | public void addOutgoingEdge(Edge out) throws MaltChainedException {
super.addOutgoingEdge(out);
if (out.getTarget() != null) {
if (out.getType() == Edge.DEPENDENCY_EDGE && out.getTarget() instanceof DependencyNode) {
Node dependent = out.getTarget();
if (compareTo(dependent) > 0) {
leftDependents.ad... |
eba1bdb2-1e2a-4e84-ad79-19ea0a4d2bd2 | 2 | private void locationClicked()
{
World<T> world = parentFrame.getWorld();
Location loc = display.getCurrentLocation();
if (loc != null && !world.locationClicked(loc))
editLocation();
parentFrame.repaint();
} |
7106cb83-5bc3-4ebe-8580-624580431284 | 6 | public static void manageProfessors() {
System.out.print("Do you want to add (0) or delete (1) a professor ? ");
int res = -1;
while (res < 0 || res > 1) {
Scanner sc = new Scanner(System.in);
res = sc.nextInt();
}
switch (res) {
case 0:
createProfessor();
break;
case 1:
if (FileRead.pr... |
2750f850-f0aa-4201-bd6b-8ab69d60e18e | 9 | protected void process(int att, int pos, BitSet C, double[][] D, double[][] minGen)
{
if (C.cardinality() < minSup) return;
if (!addCandidate(minGen, C)) return;
if (Main.printResult)
{
System.out.print(" Closed " + toStringPattern(D) +" ; ");
System.out.println("Generator " +toStringPattern(minG... |
02d24513-c922-40c8-841a-2b20c3471c2e | 3 | public void changeSelection() {
drawer.clearSelected();
Configuration[] configs;
configs = configurations.getConfigurations();
boolean foundFocused = false;
for (int i = 0; i < configs.length; i++) {
Configuration current = configs[i];
foundFocused = setFocusIfNeeded(current, foundFocused);
... |
89a7a253-cdef-4cdc-858e-ff3f7f712e53 | 4 | @Test
public final void testRemoveSeveral() {
for (int j = 1; j <= 10; j++) {
for (int i = 1; i <= 1000; i++) {
s.add(i);
}
}
// remove 10 elements 10 times
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= 10; j++) {
s.remove(j * 10);
}
}
assertEquals("Wrong size():", 990, s.size())... |
766648bd-93ce-432e-ab93-c78c8cc8ef80 | 5 | public static void main(final String[] args) {
// int n = 200;
// double pi = f(n, 6) + f(n, 75) + f(n, 89) + f(n, 226);
// System.out.println(f(n, 6) + f(n, 75) + f(n, 89) + f(n, 226)); // pi
int max = 1;
int n = 10000;
for(int a = 0; a < max; a++) {
for(int b = 0; b < max; b++) {
for(int c = 0; ... |
7233b0f4-ab8b-4f0b-b474-2b88ff2d0d9e | 1 | public byte evaluate_byte(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return 0;
}; |
c276e7ec-6a0f-4331-8873-e4c19651e873 | 8 | public String processArgs(String[] args) throws Exception {
int i = 0, j;
String arg;
char flag;
boolean vflag = false;
String outputfile = "";
String readFromFile = null;
try {
while (i < args.length && args[i].startsWith("-")) {
arg = args[i++];
if (arg.equals("-verbo... |
f22f32ca-7015-446f-86d8-113714edcac3 | 7 | public List<Argument> getArguments(boolean ordered) {
List<Argument> results = new ArrayList<Argument>();
Set<Resource> classes = JenaUtil.getAllSuperClasses(this);
classes.add(this);
for(Resource cls : classes) {
StmtIterator it = cls.listProperties(SPIN.constraint);
while(it.hasNext()) {
Statement s... |
69060a6c-a74b-4252-87ef-73e1a0b4d0e0 | 9 | public String getColumnName( int column)
{
String nom="";
switch (column) {
case 0:
nom="ID";
break;
case 1:
nom="Descripcion";
break;
case 2:
nom="Color";
break;
case 3:
nom="Peso";
break;
case 4:
nom="Consumo";
break;
case 5:
nom="Costo";
break;
case 6:
nom="C... |
be9ec134-df0a-4b24-ab7a-40326a5ed7f7 | 4 | public int getYSquares() {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: getYSquares() BEGIN");
}
if (test || m_test) {
System.out.println("GameBoardGraphics :: getYSquares() END");
}
return Y_SQUARES;
} |
eafb41ad-1d8d-4a62-9b1c-4ac8a55a6e15 | 6 | public void remove(Object removed, int type){
Drop drop = null;
if(type == 1){
for(int n = 0; n < managers.size(); n++){
if(managers.get(n).getDrop().getPath().equals((String) removed)){
drop = managers.get(n).getDrop();
ports.remove((Integer) Integer.parseInt(managers.get(n).getDrop().get... |
722e36c6-1e48-4336-bffa-0c2f41a21d24 | 1 | public void paint(Graphics g)
{
g.setColor(color);
for(int i = 0; i < currentSquares; i++)
{
g.fillRect(i * (squareWidth + padding), 0, squareWidth, height);
}
} |
3b098bb5-9ca0-4dbf-a493-571114184853 | 5 | @Test
public void testClearEdges()
{
final DCRGraph graph = new DCRGraph();
final OrdinaryCluster parent = new OrdinaryCluster(graph, 1.0);
parent.setGroundTruthIndex(0);
final ClusterAdjacencyList list = new ClusterAdjacencyList(parent);
final Node[] nodes = { new Node(), new Node(), new Node(), new Node(... |
6af833a1-6bdc-46d1-b3eb-7970172a688d | 7 | private Map<String, Set<JarFile>> buildMapOfExportsToJars() {
String classPath = System.getProperty("java.class.path");
String pathSeparator = System.getProperty("path.separator");
Map<String, Set<JarFile>> exportsToJars = new HashMap<String, Set<JarFile>>();
String[] classPaths = clas... |
3ca8bbf9-cad2-4439-ac04-64e12ededf0e | 9 | public void testResizeWithPurgeAndGetOfNonExistingElement() {
Table<Integer> table=new Table<>(3, 10, 0);
for(int i=1; i <= 50; i++)
addAndGet(table, i);
System.out.println("table: " + table);
assertIndices(table, 0, 0, 50);
assert table.size() == 50 && table.getNumMi... |
9f4ff40d-1b6a-49b9-8873-c6d18686c8e1 | 2 | public static long getVideoDurationInSeconds(File video) {
IContainer container = null;
try {
container = IContainer.make();
if (container.open(video.getAbsolutePath(), IContainer.Type.READ, null) < 0) {
throw new IllegalArgumentException("Could not open file: " + video.toString());
}
return contain... |
ae429410-8762-4749-8567-86b972ad0f6d | 8 | public static long toAmount(String price)
{
if(price.charAt(0) == '$')
price = price.substring(1);
index = price.indexOf(".");
if(index == -1)
price = price + "00";
else if(index == price.length()-1)
price = price.substring(0,price.length()-1) + "00";
else if(index == 0 && price.length() == 2)... |
85af879a-d3cd-4c27-8626-aae5d12e6800 | 7 | @EventHandler
public void WitherResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getZombieConfig().getDouble("Wither.Resi... |
6cfcddf9-c903-4eeb-af9c-99f0df6c8b93 | 6 | public void addTab(final String name) {
int i;
int matchCount = 0;// how many tabs have that name
String title;
for (i = 0; i < this.tabbedPane.getTabCount(); i++) {
title = this.tabbedPane.getTitleAt(i);
if (title.equals(name)) {
matchCount++;// exactly the same name
}
else if (title.matches(na... |
8cb2fd8e-d68b-4c5e-8c98-7701a7b0879c | 0 | public Double[][] getFVal() {
return fVal;
} |
dae8a9f2-dd78-4115-bb6c-6931b39b347c | 3 | public int maxArea2(int[] height, int start, int end, int max) {
while (end > start) {
int thisArea = Math.min(height[start], height[end]) * (end - start);
if (thisArea > max)
max = thisArea;
if (height[start] > height[end])
end--;
... |
a1e123d1-f3d2-40fd-b1c0-0071c05b0f74 | 3 | public int[] vote(int length)
{//Randomly select how many answers we're going to pick, since multiplechoice can have multiple answers
//then randomly select which indexes we think are the right answers and return this array
//part of the code is similar to the generateQuestions method in SimulationDriver for multi... |
c70ef5a3-3539-4de9-bcf6-a63173eeda73 | 4 | public static boolean implementsSerializable(final ClassEditor ce) {
if (ce.type().equals(Type.OBJECT)) {
// Stop the recursion!
return (false);
}
final Type serializable = Type.getType("Ljava/io/Serializable;");
final Type[] interfaces = ce.interfaces();
for (int i = 0; i < interfaces.length; i++) {
... |
f7225ce3-a107-4a69-97f4-3759e89d75d5 | 9 | public Debate getSpecificDebate(String id) {
Element root = document.getRootElement();
Element debateElement;
Debate debate = null;
Element debateE = (Element) document
.selectSingleNode("//debate[@id='" + id + "']");
if (debateE != null) {
String topic = debateE.element("topic").getText()
, de... |
015fdb28-bd62-41bf-ac3f-4a55ce95b05c | 3 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().write("hi");
HashMap<String,Integer> accessList=new HashMap<String,Integer>();
System.out.println("test called");
try {
URL te... |
355d0e02-4b36-45fa-af7b-a2cd49d84f4c | 5 | public void startElement(String uri, String localName,
String qName, Attributes attributes)
throws SAXException {
if(qName.equals("levelWidth")) {
inLevelWidth = true;
}
if(qName.equals("levelHeight")) {
inLevelHeight = true;
}
if(qName.equals("x")) {
inX = true;
}
if(qName.equa... |
c4424d58-3347-43c8-86ed-7ac855c9ddda | 3 | public ArrayList<Car> findCarsById(int id) {
ArrayList<Car> carList = new ArrayList<Car>();
for (int i = 0; i < 4; i++) {
for (int j = 0; j < Cars.get(i).size(); j++) {
if (Cars.get(i).get(j).getId() == id)
carList.add(Cars.get(i).get(j));
}
... |
2b35af5a-29e3-45fc-bdba-54a32742a81f | 2 | public void update() {
//if a global state exists, call its execute method, else do nothing
if(pGlobalState != null) pGlobalState.execute(pOwner);
//same for the current state
if (pCurrentState != null) pCurrentState.execute(pOwner);
} |
21074ec7-4c15-40fb-8971-e8977186dac7 | 1 | @Test
public void filtersByAuthorLastnameWorks() {
citations.add(c1);
filter.addFieldFilter("author", "Kekkonen");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c1) && filtered.size() == 1);
} |
83168f81-d41b-40c2-b8b8-cdd72acada8b | 2 | private void
writeLong(
long l )
{
if ( l <= Integer.MAX_VALUE && l >= Integer.MIN_VALUE ){
writeInt((int)l);
}else{
writeBytes(Long.toString( l ).getBytes());
}
} |
8b5a0dcd-2600-4d96-890d-a8250593d3df | 8 | static void setComboBox(JComboBox cb, int k) {
ActionListener[] al = cb.getActionListeners();
if (al != null) {
for (ActionListener i : al)
cb.removeActionListener(i);
}
ItemListener[] il = cb.getItemListeners();
if (il != null) {
for (ItemListener i : il)
cb.removeItemListener(i);
}
cb.setS... |
d6e98351-67e6-40f9-830f-8fcd78c4409f | 0 | private void setUpInfoPanel()
{
infoPanel = new JPanel();
cEquals = new JLabel("C = ");
cText = new JTextField(27);
cText.setEditable(false);
infoPanel.add(cEquals);
infoPanel.add(cText);
add(infoPanel, BorderLayout.SOUTH);
} |
9ee205b1-8ec7-40ab-8f94-1f9a2089ad91 | 5 | private static void printHelper(RBNode n, int indent) {
if (n == null) {
System.out.print("<empty tree>");
return;
}
if (n.right != null) {
printHelper(n.right, indent + INDENT_STEP);
}
for (int i = 0; i < indent; i++)
System.out.pr... |
b076b348-4b2e-42a3-bf5d-79fdd1e45b38 | 2 | public GoGame()
{
super("Go"); // name of the top of the board
groups = new ArrayList<Group>();
board = new ImageIcon("go.png");// puts the board as an image icon
whitePass = false;// boolean which checks to see if white has passed
blackPass = false;// Checks to see if black has passed
JPanel panel = new ... |
9d3c24ee-a65a-4351-8220-50c741812dae | 1 | public byte GetByte(int distance)
{
int pos = _pos - distance - 1;
if (pos < 0)
pos += _windowSize;
return _buffer[pos];
} |
a6f419cd-a067-4bd3-bc10-764fa15fc70f | 8 | public static void printQueryIteratorSolutionOrnately(QueryIterator self, QuerySolution solution, int solutionnumber, PrintableStringWriter stream) {
if (solutionnumber == Stella.NULL_INTEGER) {
solutionnumber = 0;
{ QuerySolution solution000 = null;
DictionaryIterator iter000 = ((DictionaryIter... |
5a0d5692-a05e-4a37-87cf-ee5b67520380 | 7 | private static final void method2623(AbstractToolkit var_ha, int[] is, int i, int i_19_,
int i_20_, int[] is_21_,
int[] is_22_) {
int[] is_23_ = new int[4];
var_ha.getDimensions(is_23_);
if (is_21_ != null && is_23_[3] - is_23_[1] != is_21_.length)
throw new IllegalStateException();
method2624();
... |
341d5a09-0d59-4d5a-9433-8213f9e48628 | 7 | public void addCity(City cit) {
int id;
Connection con = null;
PreparedStatement pstmt = null;
Statement idstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(d... |
eb4742b9-c09f-4e52-a689-7cb14089f1bf | 9 | public boolean renderBlockFenceGate(BlockFenceGate par1BlockFenceGate, int par2, int par3, int par4)
{
boolean var5 = true;
int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4);
boolean var7 = BlockFenceGate.isFenceGateOpen(var6);
int var8 = BlockDirectional.getDirection(va... |
660c3da5-2012-4815-a338-913b2c097613 | 6 | public void dequeueSound(String filename) {
if (!toStream) {
errorMessage("Method 'dequeueSound' may only be used for "
+ "streaming and MIDI sources.");
return;
}
if (filename == null || filename.equals("")) {
errorMessage("Filename not specified in method 'dequeueSound'");
return;
}
synchr... |
21bf31c3-051e-4b4d-b53b-86617eabdacc | 1 | private boolean jj_2_31(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_31(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(30, xla); }
} |
b7cc88fd-9cda-4842-9ef5-ca59f8567dc7 | 4 | protected Boolean IsPronome(String pTexto)
{
ConexaoMySql cn = new ConexaoMySql();
Boolean retorno=false;
String strSQL = "select cleasing_pronome from cleasing_pronome";
try{
ResultSet rs = cn.retornarResultSet(strSQL);
... |
c71b09da-e715-480b-8b3d-0b4b9537737c | 7 | public void mouseReleased(MouseEvent e) {
try {
if (mapViewer.getGotoPath() != null) {
// A mouse drag has ended (see CanvasMouseMotionListener).
PathNode temp = mapViewer.getGotoPath();
mapViewer.stopGoto();
// Move the unit:
... |
1eedad55-ce33-4d9c-866c-8410d18c0a10 | 5 | private void processWrite(SelectionKey key) throws IOException {
WritableByteChannel ch = (WritableByteChannel) key.channel();
synchronized (writeBuf) {
writeBuf.flip();
int bytesOp = 0, bytesTotal = 0;
while (writeBuf.hasRemaining() && (bytesOp = ch.write(writeBuf)... |
b7ae0753-7360-4475-9603-08d3f5ff5e1a | 3 | private static boolean isLetter(char arg0) {
return arg0 >= 'a' && arg0 <= 'z' || arg0 >= 'A' && arg0 <= 'Z';
} |
3661bf3e-64e2-4e5f-ade5-ad2ba9f45b0c | 1 | private Owner PlayerToOwner(Player p){
if(p == Player.Cathargo){
return Owner.Cathargo;
}
return Owner.Rom;
} |
a736e88b-41c2-4815-9794-fc76facad978 | 0 | protected final void setLogin(String login) {
_login = login;
} |
3d145ffe-aa29-49e4-b4d2-f475ef6b57b9 | 2 | public <T extends ICreature> Collection<T> createCreatures(IEnvironment env, int count,
IColorStrategy colorStrategy, Constructor<T> constructor) {
Collection<T> creatures = new ArrayList<T>();
Dimension s = env.getSize();
for (int i=0; i<count; i++) {
// X coordinate
double x = (rand.nextDoub... |
be798a30-71cc-4a9f-a747-80f70209ecb3 | 1 | @Override
public ArrayList<Map<String, String>> getAllWonBidsOfUser(String user) {
System.out.println("getAllWonAuctionsOfUser");
ArrayList<Map<String, String>> bidsList = new ArrayList<Map<String,String>>();
TypedQuery<Bid> allWonBidsQuery = emgr.createNamedQuery("Bid.findAllWonAuctionsByUser", Bid.class)... |
966c1d14-9df1-49eb-9ab2-81983ccc83a6 | 0 | @Override
public void connectionSuccessful() {
messagelog.append("Connected!\n");
messageToSend.setText("");
messageToSend.setEditable(true);
} |
e9ace3da-c1db-4bd3-abe2-fdbb274d69e0 | 4 | public int getMachineIndexByName(String machineFileName){
ArrayList machines = getEnvironment().myObjects;
if(machines == null) return -1;
for(int k = 0; k < machines.size(); k++){
Object current = machines.get(k);
if(current instanceof Automaton){
... |
f4c3bf79-91d7-413d-acd3-b1a5588dc849 | 2 | private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
if (Utils.promptQuestion("Weet je zeker dat je " + selectedEmployee.getFirstName() + " " + selectedEmployee.getFamilyName() + " wilt verwijderen?", true, "Ja", "Nee")) {
if (selectedEmpl... |
1073db49-a8ba-45ca-b363-1f68d807df99 | 3 | @Test
public void testBoardingPassengersOfLP() throws TrainException{
d = new DepartingTrain();
loco = new Locomotive(grossWeight, locoClassification);
d.addCarriage(loco);
passenger1 = new PassengerCar(grossWeight, passenger1Seats);
d.addCarriage(passenger1);
assertEquals(0, (int)d.numberOnBoard());
int... |
a552a1cf-10ea-4811-9405-2c4009faf650 | 3 | public int getFirstFreeSeat() {
for(int i = 0; i < seatStatus.length; i++)
for(int j = 0; j < seatStatus[i].length; j++)
if(seatStatus[i][j] == 'L')
return i*40+j;
return -1;
} |
d489f571-4650-42b2-985b-0a8dc2c45db7 | 7 | public void receiveResponse(byte[] data, int length) throws IOException {
DNSInputStream dnsIn = new DNSInputStream(data, 0, length);
int id = dnsIn.readShort();
if (id != queryID) {
throw new IOException("ID does not match request");
}
int flags = dnsIn.readShort();
... |
76085bd9-f10f-4b9b-a2c1-3a6469b8437b | 6 | private int valueXexpand(char[] charArray, int i) {
if ('X' == charArray[i]) {
if (charArray.length > i
& ('L' == charArray[i + 1] | 'C' == charArray[i + 1]
| 'D' == charArray[i + 1] | 'M' == charArray[i + 1])) {
return -10;
} else if (charArray.length + 1 > i + 1
& ('L' == charArray[i + 2]... |
49ee57fb-2d79-4752-8818-a7ed72458380 | 7 | public static Map mapEnchantmentData(int par0, ItemStack par1ItemStack)
{
Item var2 = par1ItemStack.getItem();
HashMap var3 = null;
Enchantment[] var4 = Enchantment.enchantmentsList;
int var5 = var4.length;
for (int var6 = 0; var6 < var5; ++var6)
{
Enchan... |
941fb44b-53f1-4e27-9bf7-12f39285a3f2 | 5 | public Object getValueAt(int row, int col) {
try {
BasicRecipe r = data.get(row);
switch (col) {
case 0 :
return r.title;
case 1 :
return r.style;
case 2 :
return r.brewer;
case 3 :
return r.iteration;
default :
return "";
}
} catch (Exception ... |
fac8e3e1-56d4-4c41-bbcb-941781bd0776 | 7 | public void indication(final FrameEvent e)
{
final CEMILData f = (CEMILData) e.getFrame();
final byte[] apdu = f.getPayload();
// can't be a process communication indication if too short
if (apdu.length < 2)
return;
final int svc = DataUnitBuilder.getAPDUService(apdu);
// Note: even if this is a... |
084b27e7-b0d0-4e1d-9ff7-4370dbe25f34 | 5 | @Override
public boolean show() {
if (!getTab().open()) {
return false;
}
final WidgetChild list = Widgets.get(EMOTE_WIDGET, EMOTE_LIST);
if (list == null || !list.visible()) {
return false;
}
final WidgetChild emote = list.getChild(childId);
return Widgets.scroll(emote, Widgets.get(EMOTE_WIDGET, E... |
d4dd316a-9d26-46b5-8bbd-4b0859869afc | 0 | @Override
public void mouseEntered(MouseEvent e) {
} |
16421a42-877f-45da-bafd-9effeb481cf0 | 3 | public void run() {
while (true) {
if (animationEnabled()) {
repaint();
}
try {
Thread.sleep(FRAME_DELAY);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
} |
f1dc787d-9392-4127-8b80-7f9a4b4e50aa | 3 | public void applyNoise() {
currCycle++;
currCycle %= NUMBER_OF_CYCLES_PER_CHANGE;
// every NUMBER_OF_CYCLES_PER_CHANGE we do the change
if (currCycle == 0) {
this.speed += ((random() * 2) - 1);
// maintain the speed within some boundaries
if (this.speed < MIN_SPEED) {
this.speed = MIN_SPEED;
}... |
9576bf47-2bfe-4e45-9920-9f211acc8d32 | 9 | public static List<Graph.Edge> findShortestPath(Graph g, int sourceVertex, int destinationVertex){
int n = g.getVerticesCount();
//keeping space for 1 extra cycle to detect a negative cycle
int [][]cost = new int[n+1][n];
Graph.Edge[][] retrackt = new Graph.Edge[n+1][n];
for( I... |
5fb75848-dcef-467f-85a1-f785135511c7 | 4 | public static int characterSize(int character) throws JSONException {
if (character < 0 || character > 0x10FFFF) {
throw new JSONException("Bad character " + character);
}
return character <= 0x7F ? 1 : character <= 0x3FFF ? 2 : 3;
} |
fd710c6a-3180-4107-98eb-431b02959bb0 | 3 | @Override
public int compareTo(DataChunk chunk) {
DataChunk arg0 = (DataChunk)chunk;
for (int i = arg0.getStart().length - 1; i >= 0; --i) {
if (this.getStart()[i] == arg0.getStart()[i])
continue;
return this.getStart()[i] < arg0.getStart()[i] ? -1 : 1;
}
return 0;
} |
fad72b0f-eae5-451f-adce-94558e9d2fb5 | 7 | private int alphabeta(int m, int dt, int a, int b, Board B, boolean max) {
if (dt == 0 || findPossibleMoves(max, B).length == 0) {
return getRating(max, B, m);
} else if (max == true) {
for (int i : findPossibleMoves(max, B)) {
Board nB = B;
n... |
23e2ab06-46c7-4bd3-b157-d71c71fff984 | 4 | @Override
public String display() { //Display memory on command line interface
String displayString = "";
for (int i = 0; i < MEMORY.length; i++) {
if (MEMORY[i] == null) {
if (i < 10) { //For formatting of single digits
String iString = " 0" + i;
displayString += "\n" + iString + "| ---------... |
71e5f56e-0a7f-40ac-8e83-7264f1bba0f9 | 5 | protected static Map<String, String> resolveDataProviderArguments(Method testMethod) throws Exception
{
if (testMethod == null)
throw new IllegalArgumentException("Test Method context cannot be null.");
DataProviderArguments args = testMethod.getAnnotation(DataProviderArguments.class);
... |
2b3187bd-aeaa-41a0-b291-5b807d31fd39 | 0 | protected void useCameraValue(double value) {
setSetpoint(returnPIDInput()+value);
} |
7bfe4cd3-b136-4a22-86a6-a04f8093b633 | 9 | private byte[] hashPassword(String password, byte[] nonce) throws IOException {
byte[] passw = password.toUpperCase().getBytes();
byte[] lmPw1 = new byte[7];
byte[] lmPw2 = new byte[7];
int len = passw.length;
if (len > 7) {
len = 7;
}
int idx;
... |
9746ee76-f7a7-4ae2-80eb-9cac7630513d | 6 | private void sortiere(int[] zahlen, int l, int r) {
int positionRechts = r;
/*
* Sortierung von der Mitte aus starten
*/
// int pivot = zahlen.length / 2 ;
int pivot = Math.round((r + 1 - l) / 2 + l);
System.out.println();
System.out.println("Mittelwert: " + zahlen[pivot]);
if (l... |
108f1618-1b0a-4e58-aa08-542cd6545821 | 6 | public void newGame() {
String s;
String name = "";
s = "Welcome to Ye Olde RPG!\n";
s += "\nChoose your class: \n";
s += "\t1: Warrior\n";
s += "\t2: Mage\n";
s += "\t3: Archer\n";
s += "\t4: Assassin\n";
s += "Selection: ";
System.out.print( s );
try {
role = Integer.parseInt( in.readLine() );
}
... |
557cbbb3-fe01-48a2-b806-a8e6ccf0f815 | 0 | public void updateList(ArrayList<ClientContact> contacts){
clientContactCurrent = contacts;
list.setModel(new AbstracListModelForClient(clientContactCurrent));
} |
80e4b583-7335-44bd-93d1-171e8a909b35 | 0 | public void setList(JTextArea list) {
this.list = list;
} |
6d7a25d9-73b4-41f4-875e-65ffa2f66231 | 0 | @Override
public Object clone() throws CloneNotSupportedException {
//PropertyContainerImpl cloned = new PropertyContainerImpl();
PropertyContainerImpl cloned = (PropertyContainerImpl) super.clone();
cloned.current_values = (HashMap) this.current_values.clone();
cloned.default_values = (HashMap) this.default_v... |
0b4df8fb-9136-40c5-9a3c-f313a94dd3ae | 1 | private void notifyOfLockedStateWillChange() {
for (OutlineModelListener listener : getCurrentListeners()) {
listener.lockedStateWillChange(this);
}
} |
e0f84b77-a48b-4405-ad0f-3b7a4e863221 | 4 | public ScriptFile(String fileName)
{
this.fileName = fileName;
try
{
BufferedReader reader = new BufferedReader(new FileReader(fileName));
while (reader.ready()) {
String line = reader.readLine().trim();
if (line.length() == 0)
... |
216664a9-df2c-4848-a219-86d0cb4d27c4 | 6 | public double getProbability(String[] ratings) {
int n = ratings.length;
ArrayList<Integer> list = new ArrayList<Integer>();
int Enumber;
int x;
int R;
double ans = 0.0;
String str = "";
for(int i = 0;i < n;i++){
str = str + ratings[i];
}
String s[] = str.split(" ");
for(int i = 0;i < s.leng... |
43dd41e1-5613-4498-9edc-cc0939c45795 | 3 | private static int[] getCrewsIndices() {
Set s = (Set<Crew>) map.get(flightList.getSelectedValue().toString());
int[] selectedIndices = new int[s.size()];
for(int i = 0; i<s.size(); i++){
for(int j=0; j<data.fetchCrewsList().length; j++){
if(data.fetchCrewsList()[j].toString().equals((s.toArray()[i]).toSt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.