method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
83a7376a-8943-499f-acbd-3b9664c12539 | 8 | @Override
public Object esegui() throws ExtraTokenException, OperazioneNonValidaException, ParentesiParsingException, OperandoMissingException, ParsingException, OperatoreMissingException
{
VarRepository variabili = VarRepository.getInstance();
ArrayList<Token> lineaCodiceProvvisoria = (ArrayList<Token>)lineaCodi... |
becfa525-d252-4f42-911b-1ac6935db9be | 0 | public DialogSettings() {
super();
initComponents();
} |
c9859de8-9d0b-40c4-9ec8-1c2fe31556bd | 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... |
d44854d3-7474-4f54-b3b5-123a867c8f1c | 2 | public void editStartURL() {
JFileChooser fc = new JFileChooser();
fc.setMultiSelectionEnabled(false);
int result = fc.showOpenDialog(null);
if (result != JFileChooser.APPROVE_OPTION) return;
URL url = null;
try {
url = fc.getSelectedFile().toURI().toURL();
... |
5758cb0e-4441-4380-a215-6d7154c5d0f7 | 5 | private void timeOut() {
boolean timedOutBeforeConnecting = false;
boolean timedOutAfterConnecting = false;
synchronized(CONNECTION_LOCK) {
if(isAttemptingToConnect) {
logger.fine("Connection to " + serverAddress + ":" + serverPort + " timed out");
closeConnection();
timedOutBeforeConnecting = true... |
5febf144-3077-4cb6-9e8f-6229d1981fcf | 8 | public static void main( String[] argv ) throws IOException {
BufferedReader reader = new BufferedReader( new FileReader( ITEM_KEYWORDS ) );
System.out.println( "Scanning for keyword array size" );
int linesComplete = 0;
String line = reader.readLine();
while( line != ... |
a342782d-7881-4bb8-abf4-a90ea2ee6baf | 6 | protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
AjaxRequest ajaxRequest = AjaxRequest.action(request);
Player player = ajaxRequest.getPlayer();
Field field = ajaxRequest.getField();
String status = "true";
Integer amount = 0;
Transa... |
32ad2c9a-4336-408e-9ca7-0133e23740a0 | 3 | public boolean load(String audiofile) {
try {
setFilename(audiofile);
sample = AudioSystem.getAudioInputStream(getURL(filename));
clip.open(sample);
return true;
} catch (IOException e) {
return false;
} catch (UnsupportedAudioFileException e) {
return false;
} catch (LineUnavailableException... |
fc031e6a-af8c-47d3-a3c4-3393c7d88541 | 9 | public void handshake() throws Exception {
String raw_message = "";
String[] token = new String[3];
generateHash();
while(true) {
while(incoming.ready()) {
raw_message = incoming.readLine();
token = raw_message.split(":");
if(token[0].equals("hash")) {
sendHandshakeMessage("hash:" + serverI... |
02fff640-e28b-4698-a8cc-d0238cd8c931 | 9 | public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[58];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 31; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
i... |
55f4f1c0-88ab-4cd4-94e4-1af4cec44416 | 3 | @Override
public void deserialize(Buffer buf) {
msgType = buf.readByte();
if (msgType < 0)
throw new RuntimeException("Forbidden value on msgType = " + msgType + ", it doesn't respect the following condition : msgType < 0");
msgId = buf.readShort();
if (msgId < 0)
... |
ad487df7-81a2-4a1e-af80-3d4c74f1ea8a | 3 | public boolean notReadyToPlay() {
detectLinesAndCols();
for (int i = 0; i < 8; i++)
for (int j = 0; j < 8; j++)
if (matrixb[i][j])
return true;
return false;
} |
650227ab-5407-4a23-a6d6-c332bb987b8e | 2 | public List<E> getAll() {
List<E> clients = new ArrayList<E>();
try
{
ResultSet rs = select.executeQuery();
while(rs.next()){
clients.add(build(rs));
}
}
catch(Exception ex)
{
ex.printStackTrace();
}
return clients;
} |
061defbc-9809-4916-a5ff-f98468844f05 | 1 | protected Integer calcBPB_TotSec16() {
byte[] bTemp = new byte[2];
for (int i = 19;i < 21; i++) {
bTemp[i-19] = imageBytes[i];
}
BPB_TotSec16 = byteArrayToInt(bTemp);
System.out.println(BPB_TotSec16);
return BPB_TotSec16;
} |
3f00306f-b2b1-425f-9112-679dcf04b145 | 5 | public void populateCritter(int numCritters,
Class<? extends Critter> critterType) {
populationCounters.put(critterType, new Integer(numCritters));
for (int i = 0; i < numCritters; i++) {
if (population == maxPopulation) {
return;
}
try {
addCritter(critterType.newInstance());
} catch (Insta... |
f905a4a6-1014-4809-bdb0-86012a0e34f2 | 2 | private static final long[] evaluate(long[] data) {
long[] evl = new long[smp.length];
for (int i = 0; i < smp.length; i++) {
evl[i] = 1L;
for (long j : data) evl[i] = PF.mul(evl[i], PF.sub(smp[i],j));
}
return evl;
} |
c0f399ce-f4e2-49ba-ab62-a66f722c6a58 | 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... |
3ef5b2cc-11d3-4da9-bd9a-d69dd1ffe6c2 | 6 | public void makeDeclaration(Set done) {
super.makeDeclaration(done);
if (isConstructor() && !isStatic()
&& (Options.options & Options.OPTION_ANON) != 0) {
ClassInfo clazz = getClassInfo();
InnerClassInfo outer = getOuterClassInfo(clazz);
ClassAnalyzer clazzAna = methodAnalyzer.getClassAnalyzer(clazz);... |
09739665-546c-41a4-ba26-b03535e45276 | 7 | protected void readChild(XMLStreamReader in) throws XMLStreamException {
Game game = getGame();
if (in.getLocalName().equals(IndianSettlement.MISSIONARY_TAG_NAME)) {
in.nextTag(); // advance to the Unit tag
missionary = updateFreeColGameObject(in, Unit.class);
in.next... |
e8614467-bf1e-414b-867a-4f750f79041b | 5 | public static void parse(final File file, final ConfigHandler handler) throws IOException, ParseException {
final String raw = IOUtils.toString(new FileInputStream(file));
final JSONArray routes = (JSONArray) JSONValue.parseWithException(raw);
for (Iterator<Object> iter= routes.iterator() ; iter... |
eb735a47-538e-4132-b59a-bdd1cf000b8e | 2 | private void updateBuyButton()
{
if (Inventory.money >= amount && amount > 0)
buyButton.setEnabled(true);
else
buyButton.setEnabled(false);
} |
747c02fb-e4a0-421e-839b-7ab2f6a722d9 | 4 | public boolean addStore(OfflinePlayer player,Chest chest){
if(player==null || chest==null)
return false;
if(isStore(chest))
return false;
if(isCoffer(chest))
return false;
stores.put(chest, new Store(this,player,chest));
saveStores();
return true;
} |
e6fe5849-1d48-4112-ae1d-966093a7d8bf | 9 | public void ensureContainedTablesExist(ConnectionWrapper cw) throws SQLException, SchemaPermissionException
{
// a list of contained classes that must be added
ArrayList<Class<?>> containedClasses = new ArrayList<Class<?>>();
if (this.clazz.isArray())
{
if (!ObjectTools.isDatabasePrimitive(clazz.getCompone... |
acf7aff0-9cd6-4bc1-8002-184b6923aade | 0 | public int getBoilerState() {
return this.boilerState;
} |
dd7b201e-7d1d-4504-90a4-af42a0ab24c5 | 6 | public List<List<Card>> getSets(List<Card> cards) {
List<Card> flushSet;
List<Card> pairSet1;
List<Card> pairSet2;
List<Card> straitSet;
List<List<Card>> pairSets;
List<List<Card>> sets;
sets = new ArrayList<>();
pairSets = Ranking.checkP... |
5e3d93d2-9a0c-49db-8241-d279bdbbffa2 | 4 | public boolean accept(File file){
if (file.isDirectory()){
return true;
}
else {
String path = file.getAbsolutePath().toLowerCase();
for (int i = 0, n = extensions.length; i < n; i++) {
String extension = extensions[i];
if ((path.endsWith(extension) && (path.charAt(path.length() - extension.lengt... |
64a68610-ee42-4ba3-a246-4b02c2e6e9d2 | 5 | public static Object invokeMethod(Object o, String methodName) {
if (Functions.isEmpty(methodName)) return null;
if (o == null) return null;
Object retObj;
try {
Class<?> c = o.getClass();
if (c == null) return null;
Method m = c.getMethod(methodName);
retObj = m.invoke(o,new Object[0]);
} catch (... |
d0cc6540-4d61-4c33-a3cd-90cbe07152b7 | 8 | @Override
public void mouseMoved(MouseEvent e) {
Point point = e.getPoint();
if (e.getSource() == _north) {
if (point.x <= _borderWidth) {
// Mouse located at North-West edge
_north.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
... |
515647ed-7492-45ec-8d96-f2c9a1ffaf07 | 5 | public static void main(String[] args) throws InterruptedException
{
final Terminal rawTerminal = new TestTerminalFactory(args).createTerminal();
rawTerminal.enterPrivateMode();
int currentRow = 0;
rawTerminal.moveCursor(0, 0);
while(true) {
Key key = rawTerminal... |
56d445e3-f6d8-4e44-a0c2-2434227b6e46 | 5 | public void update(Object target, String fieldname)
{
if (target != null && fieldname != null)
{
try
{
Method getter = target.getClass().getMethod(
"is" + fieldname);
if (getter != null)
{
Object current = getter.invoke(target);
if (current instanceof Boolean)
{... |
a57a8bbc-3fe7-4c5f-b103-98d34c0001fb | 4 | public int []nextWinningMove(int token) {
for(int i=0;i<3;i++)
for(int j=0;j<3;j++)
if(getBoardValue(i, j)==EMPTY) {
board[i][j] = token;
boolean win = isWin(token);
board[i][j] = EMPTY;
if(win) return new int[]{i,j};
}
return null;
} |
857f4d20-38f8-406f-9ac1-4e6386e8bde5 | 5 | public boolean deplacerPiece(Piece p, Point point) {
boolean succes = false;
if (Echiquier_deplacement_Utils.estAutorise(p, this, point)) {
if (this.getPieceCase(point) != null) {
if (this.jeuCourant == this.j1) {
this.j2.mangerPieceCase(point);
... |
f6a61dac-17c1-4b65-99be-793e2b44fa8e | 7 | public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length;
int n = obstacleGrid[0].length;
int[][] A = new int[m][n];
for (int i = 0; i < m; i++) {
if (obstacleGrid[i][0] == 1)
break;
A[i][0] = 1;
}
for (int i = 0; i < n; i++) {
if (obstacleGrid[0][i] == 1)
bre... |
0a14e388-8142-40a0-9e39-e6d807a65eb5 | 2 | public void show() {
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++)
System.out.printf("%9.4f ", data[i][j]);
System.out.println();
}
} |
642b96c0-7092-445d-a4b3-fc97bf24d9b4 | 3 | public void use(BattleFunction iface, PokeInstance user, PokeInstance target, Move move) {
if (this.target == Target.target) {
target.battleStatus.resetStats();
} else {
user.battleStatus.resetStats();
}
if (text != null) {
text = text.replace("$target", target.getName());
if (target.battleStatus.la... |
d74ec231-82b5-4aca-b3cf-c0e6fdb9c724 | 7 | private static void writeAllData(String filename) throws IOException
{
FileWriter fw = new FileWriter(filename, false);
HashMap<String, Averaging> statistic = new HashMap<String, Averaging>();
//
// Write header to file
//
Object[] headers = keys.keySet().toArray();
java.util.Arrays.sort(headers);
... |
f851037a-cfb6-47d3-8af5-2511a8887d0e | 9 | private char escapedStringChar(PositionTrackingPushbackReader par1PositionTrackingPushbackReader) throws IOException, InvalidSyntaxException
{
char c1 = (char)par1PositionTrackingPushbackReader.read();
char c;
switch (c1)
{
case 34:
c = '"';
... |
ebb06401-d548-407b-995a-1dd9f0085651 | 1 | public static void plot(int size) {
PlotFrame frame = new PlotFrame("Energy", "Propagation", "Propagation");
frame.setSize(600, 600);
for (int i = 0; i < size; i++) {
// frame.append(0, x[i], y[i]);
frame.append(0, i, i);
frame.append(1, i, i * i);
}
... |
d0d8d52a-e4ec-4e13-99fc-73766f23a593 | 3 | public void set(AlumnoBean oAlumnoBean) throws Exception {
try {
oMysql.conexion(enumTipoConexion);
oMysql.initTrans();
if (oAlumnoBean.getId() == 0) {
oAlumnoBean.setId(oMysql.insertOne("alumno"));
}
oMysql.updateOne(oAlumnoBean.getId... |
d711a9f9-ccef-4aea-b221-add1955f2164 | 8 | void add(Map<SearchState,SearchState> nextQueue, Node<String> node, int startIndex,
double chunkScore,
boolean isTokenEnd,
Map<Dp,Chunk> chunking, char[] cs, int end) {
if (chunkScore > mDistanceThreshold)
return;
SearchState state2
= new ... |
7c1c7a6f-4edf-40f7-b3c2-47ca398171a7 | 2 | @Override
public void onGameEnd(int result, Object arg) {
if (result == 1) {
this.send("GAME-END " + result + " " + ((Player) arg).getName());
} else if (result == -1) {
this.send("GAME-END " + result);
}
} |
c95e0aed-b622-4fc8-a805-a26178889ce0 | 1 | @Override
public String getName() {
String name = super.getName();
if (name == null) {
return DEFAULT_NAME;
} else {
return name;
}
} |
64504b3d-286f-4a26-81a2-9b3f39cf2d6c | 3 | public static void main(String[] args) {
//String protocolName = "rmi";
String protocolName = "triple";
BasicProvider<DemoService> basicProvider = new BasicProvider<DemoService>(protocolName);
basicProvider.exportService(DemoService.class);
System.out.println("input 'stopServer' to stop provider service");
... |
64fa00e4-8567-467a-a6af-2c02feab65be | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Permissao other = (Permissao) obj;
if (grupo == null) {
if (other.grupo != null)
return false;
} else if (!grupo.equals(other.grupo))
... |
76841e65-d9c0-4f86-90ed-8b18e0687b4f | 4 | public void printPaths()
{
for(int i = 0; i < Game.map.height; i++)
{
System.out.print("[");
for(int j = 0; j < Game.map.width; j++)
{
if(movement[j][i] > 0) {
System.out.print(movement[j][i] + ",\t");
}
... |
24b02209-dcca-44e0-9294-a26e7c57c8c0 | 4 | public void mkFile(HashMap<String, SVGGraphics2D> p_recentPaintingObjects)
{
for (Entry<String, SVGGraphics2D> pair : p_recentPaintingObjects.entrySet())
{
// Begin : How are the directory paths this SVG objects will need
String objectDir = pair.getKey().substring(0, pair.getKey().lastIndex... |
13a8131f-9101-4c3b-b172-cc6d96698e12 | 8 | @Override
public long execute(AMD64Environment env, IInstruction instruction) {
List<IOperand> operands = instruction.getOperands();
if (operands.size() == 2) {
IOperand op1 = operands.get(0);
IOperand op2 = operands.get(1);
int op_width1 = env.getOperandWidth(op... |
f7a2b6e5-bc84-4f98-ae46-fcec2bde6582 | 4 | short deinitialize()
{
// Before killing this thread, check if the thread is STILL alive
if(!t.isAlive())
MsgAnalyzerCmnDef.WriteDebugSyslog("The worker thread in the SerialReceiver object did NOT exist......");
else
{
exit.set(true);
MsgAnalyzerCmnDef.WriteDebugSyslog("The worker thread in the SerialRe... |
7cd576b9-7c01-43a6-b354-bc905664309c | 2 | public void draw (JEditorPane editor)
{
StringBuffer buf = new StringBuffer ();
String name = toString ();
editor.setContentType ("text/html");
buf.append ("<html>\n<head><title>");
buf.append (name);
buf.append ("</title></head>\n<body><font size=+1><b>");
buf.append (name);
buf.append ("</b></font><br>... |
1994a698-02d1-4489-899a-ae95774ac12b | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ComputerPart other = (ComputerPart) obj;
if (nam... |
5a9db105-1843-4b43-888b-a5e678ce9d31 | 1 | public void clear_buffer()
{
for (int i = 0; i < channels; ++i)
bufferp[i] = (short)i;
} |
10da7323-304c-44c2-9c2a-8dd8e2d28f67 | 6 | public String nextCDATA() throws TXMLException {
char c;
int i;
StringBuffer sb = new StringBuffer();
for(;;) {
c = next();
if(end()) {
throw syntaxError("Unclosed CDATA");
}
sb.append(c);
i = sb.length() - 3;
if(i >= 0 && sb.charAt(i) == ']' &&
sb.charAt(i + 1) == ']' && sb.charAt(i ... |
87602c7a-f704-47fe-af64-c44385b722da | 2 | private static String createExecutionEnvironment(HardwareAlternative platformAlternative, String hardwareSetId, DeploymentAlternative deploymentAlternative) {
String executionEnvironment = "\t\t<nestedNode xmi:type=\"uml:ExecutionEnvironment\" xmi:id=\"" + platformAlternative.getId() + "\" name=\"" + platformAlternat... |
9b4b3429-90e1-4389-85c2-48bdafa7524f | 3 | private void copyAndStrip(File sourceJar, File targetJar) throws IOException
{
ZipFile in = new ZipFile(sourceJar);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(targetJar)));
for(ZipEntry e : Collections.list(in.entries()))
{
if... |
8b2a490b-2abe-473f-80e4-bc94bad5a3f7 | 0 | @Override
public double access(Balance balance) {
return balance.getBalance();
} |
006b16ad-65aa-4bc5-a1d3-d5d30e409f04 | 8 | void deleteArrow(int col)
{
switch(col)
{
case 1:
if(_arrows[4][0]!=null)
{
_arrows[4][0]=null;
upArrowDeleted=true;
}
break;
case 2:
if(_arrows[4][1]!=null)
{
_arrows[4][1]=null;
leftArrowDeleted=true;
}
break;
case 3:
if(_arrows[4][2]!=null)
{
... |
3988376d-2530-45a5-afc3-15890893ea5f | 2 | private String getTeacher(List<String> teachers)
{
String s = "";
for(String t : teachers){
s += t + ", ";
}
if(s.length() > 0)
{
s = s.substring(0, s.length()-2);
}
else
{
s = "None";
}
return s;
} |
89a941a7-4d93-4a55-8cd0-857bac28f528 | 3 | private userDao()
{
Properties properties = new Properties();
try {
properties.load(new FileInputStream("c:\\Users\\Igos\\workspace\\newsLine\\config.properties"));
String dbURL = properties.getProperty("baseurl");
String user = properties.getProperty("user");
String password = properties.getProperty("... |
16245c1b-4883-4324-af6c-635dc8dfaedb | 2 | private String getListBy( String variable ) {
StringBuilder sb = new StringBuilder();
if ( hasSearch ) {
for ( int i = 1; i < searchList.size() + 1; i++ ) {
sb.append( "\n" + TAB + TAB + "List<" + variable + "> list" + i
+ "= " );
sb.a... |
e2c7ff5b-f813-4b2a-81c7-53c87836f75f | 2 | @Override
public void mousePressed(MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e)) {
if (Main.modState == ModState.Editing) {
Point clickedPoint = getClickedPoint(e);
handlePointSelection(clickedPoint);
}
}
} |
0ec609ae-6796-455d-8d20-e17ff374078c | 0 | public void setStworz(String stworz) {
this.stworz = stworz;
} |
8f7c61c9-c861-47a0-90d6-bc5d4a1d4174 | 9 | public mxGraphHierarchyModel(mxHierarchicalLayout layout,
Object[] vertices, List<Object> roots, Object parent,
boolean ordered, boolean deterministic, boolean scanRanksFromSinks)
{
mxGraph graph = layout.getGraph();
this.deterministic = deterministic;
this.scanRanksFromSinks = scanRanksFromSinks;
this.r... |
03e08acc-7ea1-447d-b3c4-7b2e576462d9 | 9 | public void Process(int id){
switch(id){
case 241:ColorReasoning(0);//浅
break;
case 242:ColorReasoning(1);//相等
break;
case 243:ColorReasoning(2);//深
break;
case 301:ActivateForceSpace();
break;
case 341:DynamicForceReasoning();
break;
case 401:ActivateObjectSpace();
break;
case 261:Ge... |
39df2d5e-ea7b-45f9-939f-f37bd603ee90 | 4 | public void setMapValue(){
if( pointer_x >=0 && pointer_x < Constant.MAP_Array_SIZE && pointer_y < 80 && pointer_y >=0)
this.array[pointer_x][pointer_y] = this.current_type ;
} |
5adec9a2-0677-49e1-81ea-f2fbcc2b4978 | 6 | @Override
protected void lock() {
while (true) {
if (!calcLocker.isWriteLocked() && calcLocker.writeLock().tryLock())
if (calcLocker.getWriteHoldCount() != 1)
calcLocker.writeLock().unlock();
else if (hasAdjustment() == PRO_ADJ_PAR
... |
594ac6cd-8499-4399-a6e6-138cbbec8ac8 | 2 | public HiddenNode(double act, NeuralNet dd, int lNo){
super(act,dd); layerNo=lNo;
int hlp;
if(layerNo==0)
hlp = dis.getInputNo();
else hlp = dis.getHiddenLayers()[layerNo-1];
brnI = new Branch[hlp];
if(dd.getHiddenLayersNo()==layerNo+1)
hlp = dis.getOutputNo();
else hlp = dis.getHiddenLayers()[lay... |
3b477602-92de-4448-bb6a-ddfd028d6e58 | 9 | public void connectHLine(String fieldType, CABot3Net retNet, CABot3Net linesNet) {
int netSize =retNet.getInputSize();
int retinaOffset = getRetOffset(fieldType)*netSize;
int lineOffset = getLineOffset(fieldType, "Hline")*netSize;
int column;
int row;
int cols = retNet.getCols();
double weig... |
a0873f58-3a51-407c-827d-833740d6123b | 9 | @SuppressWarnings("deprecation")
@EventHandler
public void onProjectileHit(ProjectileHitEvent event) {
Projectile projectile = event.getEntity();
if (!(projectile instanceof Arrow))
return;
Arrow arrow = (Arrow)projectile;
if (!(arrow.getShooter() instanceof Player)) {
return;
}
BlockIterator b... |
9c292bcf-53ab-42d9-9887-e70bb3515bb8 | 0 | public void initListe() {
TableModel listeModele = new AbstractTableModel() {
@Override
public String getColumnName(int col) {
return titres[col].toString();
}
public int getColumnCount() {
return titres.length;
}
public Object getValueAt(int row, int col) {
return donnees[row][col];
... |
ab1599ca-dacf-4038-bfc9-16101e387603 | 3 | public static List<Integer> preorderTraversal(TreeNode root) {
List<TreeNode> stack = new ArrayList<TreeNode>();
List<Integer> res = new ArrayList<Integer>();
TreeNode node = root;
while (null != node || 0 != stack.size()) {
while (null != node) {
res.add(node.val);
stack.add(node);
node = node.l... |
b3b5d778-9b79-4ca3-9ff3-072aee710674 | 4 | public String getAttribute(String attribName) {
if ((pdu.getPdu().equals("PSSRR")) || (pdu.getPdu().equals("PSSDR"))) {
ArrayList attribs = pdu.getAttribs();
for (int i=0; i < attribs.size(); i++){
String[] attrib = (String[])attribs.get(i);
if (attrib[0].... |
54d1fcd1-fb62-4713-97ae-7662b511d333 | 7 | private void removePars()
{
try{
String inPars;
boolean foundEndPars=false;
int beginPars=0, endPars=0;
while(beginPars!=-1&&endPars!=-1)
{
foundEndPars=false;
beginPars=input.indexOf("(");
endPars=beginPars;
if (beginPars!=-1)
... |
4070c8f0-c428-4cad-92c3-b286fdae313e | 2 | private boolean jj_3R_93() {
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_16()) { jj_scanpos = xsp; break; }
}
return false;
} |
f6ab6013-2ffd-4d16-a552-28e19ed3374e | 0 | public Point2D getTopRight() {
return new Point2D(width, y);
} |
2f466076-e8d7-48ac-b835-d6dfc6c5d8ef | 7 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
if(msg.amITarget(this))
{
final MOB mob=msg.source();
switch(msg.targetMinor())
{
case CMMsg.TYP_WAND_USE:
if((mob.isMine(this))
&&(!amWearingAt(Wearable.IN_INVENTORY))
&&(msg.targetMessage()!=null))
{
... |
6758ab23-d5f6-4820-a50c-7e896a857198 | 7 | @Override
public void lock(int thread_id)
{
choosing_[thread_id] = true;
choosing_ = choosing_; //force the other threads to see that choosing_[thread_id] has updated
number_[thread_id] = max() + 1;
choosing_[thread_id] = false;
choosing_ = choosing_; //force the other threads to see that choosing_[thread_i... |
662333b6-c287-4b9b-a5f2-694f1ed0abca | 2 | @Override
public int compareTo(StarSystem o) {
return (this.getMass() < o.getMass()) ? -1 : (this.getMass() > o.getMass()) ? 1 : 0;
} |
c1e4ae81-4437-4b5b-9632-562d1113f600 | 3 | public void mouseClicked(MouseEvent e){
//sets the string details equal to the click count.
details = ("You clicked: "+ e.getClickCount());
//if the button that was pressed is equal to the
//left button, middle wheel, or the right button
//the string details gets this text added on depending wh... |
0eeb849c-61ce-47f0-b3c0-9bbc13b02100 | 2 | public static void win(int elapsedTime, int numMoves) {
prefs.putInt("wins", prefs.getInt("wins", 0) + 1);
if (getLowestMoves() > numMoves) {
setLowestMoves(numMoves);
}
if (getBestTime() > elapsedTime) {
setBestTime(elapsedTime);
}
} |
62b7dde3-ddaa-4809-b5ec-7cdda2646047 | 5 | @Override
public void actionPerformed(ActionEvent e) {
//browse button
if(e.getActionCommand().equals(Strings.MENU_DATA[4])){
JFileChooser fc = new JFileChooser();
fc.setPreferredSize(new Dimension(600,600));
int returnVal = fc.showOpenDialog(Soartex_Patcher.frame);
if (returnVal != JFileChooser.APPROV... |
2d5f5738-339d-45e1-b2ce-f726b3e566b3 | 2 | @Override
public String getNamespaceURI(String prefix) {
String url = XMLConstants.NULL_NS_URI;
if(this.map != null && this.map.containsKey(prefix)) {
url = this.map.get(prefix);
}
return url;
} |
8de17610-bf59-4c9f-ac81-882483608fc6 | 1 | public static void dolaresToEuros(){
final BufferedReader stdin=new BufferedReader (new InputStreamReader(System.in));
try{
System.out.print("Intoduce el importe en dolares => ");
dolar=Double.parseDouble(stdin.readLine());
System.out.println("El valor de cambio es "+cambio+"€ => 1 $");
System.out.prin... |
2689023c-8fb7-43f0-952b-40c7a339d4f2 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TypeDeclarationNode other = (TypeDeclarationNode) obj;
if (ident == null) {
if (other.ident != null)
return false;
} else if (!ident.... |
33cd8710-5c65-4e68-ae5a-7510ded72687 | 1 | private double exptLessThan(double b) {
double sum=0,interval=(b-12)/1000,val=12;
for (int i = 0; i <1000; i++) {
sum+=phi(val, mu, sigma)*val*interval;
val+=interval;
}
return sum/probLessThan(b);
} |
e9a426c3-6a2a-4809-affa-26b36fe16210 | 2 | private JPanel prepareParamControls(JTextField posStart, JTextField posEnd,
final JTextField winSize, final JTextField shiftIncr, JCheckBox useSlide)
{
JPanel controlField = new JPanel(), startField = new JPanel(), endField = new JPanel(), checkBoxField = new JPanel(), windowField = new JPanel(), shiftField... |
46519dd9-c98b-4c6a-ad55-024554d87430 | 3 | public int[] getSlotItemIDs() {
Vector<Integer> v = new Vector<Integer>();
for (Widget slot : getSlotWidgets()) {
int i = slot.getParentId();
if (i != -1) {
v.add(i);
}
}
int[] ia = new int[v.size()];
int index = 0;
for (int i : v) {
ia[index] = i;
index++;
}
return ia;
} |
a308c22c-ed0c-464c-9b21-d4dc24406ea7 | 7 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length == 0) {
ChatChannel cc = plugin.getChannel("Global");
ChatPlayer cp = plugin.getChatPlayer(sender.getNa... |
4699f155-3edd-4df1-a514-1cd09e62fdb3 | 2 | public void match(Pipe pipe_) {
int idx = pipes.indexOf (pipe_);
// If pipe is already matching do nothing.
if (idx < matching)
return;
// If the pipe isn't eligible, ignore it.
if (idx >= eligible)
return;
// Mark the pipe as matchin... |
3ca338bd-ebda-4e03-9f79-64571ad0843b | 6 | public static void writeCommandsForU(ArrayList<String> tl){
ArrayList<String> cmds=rfa.readInputStream(GenerateInitScripts.class.getResourceAsStream("config/srcOds/CommandsForU.sh"),"UTF-8");
StringBuffer content=new StringBuffer();
for (int i = 0; i < cmds.size(); i++) {
if(cmds.get... |
1d1aab9f-b651-4bc8-9e78-575b82d45002 | 0 | public Integer getErrorCount() {
return errorCount;
} |
156aaf90-54e9-41d8-8655-99d47214f754 | 7 | public static List<Person> getAllPeople() {
List<Person> people = new ArrayList<Person>();
Connection conn = null;
Statement stmt = null;
try {
// STEP 2: Register JDBC driver
Class.forName("com.mysql.jdbc.Driver");
// STEP 3: Open a connection
System.out.println("Connecting to database...");
co... |
8853a819-7b8a-42ee-a1a8-d007e93d24fd | 7 | public static boolean isAdjacentTo(Board board, int player, int x, int y) {
int boardSize = board.boardSize;
int[][] intersections = board.intersections;
return (x > 0 && intersections[x - 1][y] == player) ||
(x < boardSize - 1 && intersections[x + 1][y] == player) ||
(y > 0 && intersections[x][y - 1] == ... |
af4dcf44-1950-43a2-818c-d81be00c971a | 7 | public int look(int bits){
int ret;
int m=mask[bits];
bits+=endbit;
if(endbyte+4>=storage){
if(endbyte+(bits-1)/8>=storage)
return (-1);
}
ret=((buffer[ptr])&0xff)>>>endbit;
if(bits>8){
ret|=((buffer[ptr+1])&0xff)<<(8-endbit);
if(bits>16){
ret|=((buffer[p... |
83f02441-6310-4ff4-ae47-e4573afa9969 | 5 | private int getOption()
{
while (true)
{
try
{
System.out.print("\nEnter option: ");
int option = new Scanner(System.in).nextInt();
if (option >= 1 && option <= menuItems.length
|| option == EXIT_OPTION)
... |
a0edc4d6-91bc-4783-82b0-f478735a094a | 6 | @Override
public void start(final Stage primaryStage) throws JAXBException {
primaryStage.setTitle("een");
opslag = new ObjectenOpslag(root, null);
label = new Label("Welkom!!!!");
root.getChildren().add(label);
rz = new Rugzak();
... |
ef941158-f5dc-4331-a55a-2c6a917c0c43 | 0 | @Test public void itShouldNotSerializeEmptyProperties() throws Exception
{
TestGeoJsonObject testObject = new TestGeoJsonObject();
Assert.assertEquals("{\"type\":\"TestGeoJsonObject\"}", mapper.toJson(testObject));
} |
235cabe9-f797-4b77-a1be-9f87c43e23e6 | 4 | public boolean game_over(){
return table.is_complete() ||
WHITE_SCORE ==0 ||
BLACK_SCORE == 0 ||
(cpuValidMoves.size()==0 && playerValidMoves.size()==0);
} // end game_over |
d288c9ac-a72a-4575-a84b-ccf5d28fffe9 | 2 | protected String queryWithWhoisServer(final String domainName, final String whoisServer) {
String result = "";
try {
WhoisClient whois = new WhoisClient();
whois.connect(whoisServer);
result = whois.query(domainName);
whois.disconnect();
} catch (SocketException e) {
} catch (IOException e) {
}
... |
a7ae9f1d-ac23-41bf-a390-89996d2fb645 | 5 | public boolean translate(Polyomino poly, int dx, int dy){
for (Point loc:poly.getTranslateLocs(dx, dy)){
if (loc.y<0 || loc.x<0 || loc.x>=fWidth ||
contents[loc.y][loc.x] != null) return false;
}
poly.translate(dx, dy);
return true;
} |
ea065adc-82e7-445e-a79f-a13cc076e8b4 | 2 | @Override
public int getLockWriteCount(String objectType) {
int result = 0;
String lockStart = objectType + lockSeparate;
for (int i = 0; i < writeLocks.size(); i++) {
String lockName = writeLocks.get(i);
if (lockName.startsWith(lockStart)) result++;
}
return result;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.