method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
321240af-1ba2-400c-8de8-cdde7bf96abe | 8 | private boolean r_Step_1c() {
int v_1;
// (, line 51
// [, line 52
ket = cursor;
// or, line 52
lab0: do {
v_1 = limit - cursor;
lab1: do {
... |
54fbb8a4-55eb-4818-8ac2-0caccd4de6ac | 0 | void pushSearchTask(File f) throws InterruptedException {
taskQueue.push(new FileSearchBean(f));
} |
a373ba62-780c-4561-ab24-3f16678c10e0 | 7 | public void reproduceAvg(int cutoff){
Random rand = new Random();
int numOffsprings = C(cutoff,2);
if(numOffsprings + cutoff > population.length){
System.out.println("Invalid cutoff!");
return;
}
Stack<Cell> temp = new Stack<Cell>();
for(Cell c : p... |
5617e5e5-fea4-48a6-85c8-c7978072d12e | 0 | @Override
public AbstractPlay mkRandom() {
return everyPlay.get(rnd.nextInt(everyPlay.size()));
} |
5275af35-bcf3-4b26-8002-4b14e15697d9 | 4 | public final T getNode(int x, int y) {
if(x < 0 || x > width || y < 0 || y > height){
throw new IllegalArgumentException("X & Y must be more than 0, but less than w/h");
}
return nodes[x][y];
} |
02a4442b-16bd-4492-bb59-f36fcd3fb938 | 7 | public Symbol debug_parse()
throws java.lang.Exception
{
/* the current action code */
int act;
/* the Symbol/stack element returned by a reduce */
Symbol lhs_sym = null;
/* information about production being reduced with */
short handle_size, lhs_sym_num;
/* set up ... |
f960a7ac-c129-46ca-9d5d-a861523dcfd3 | 0 | public TPLogger(Logger logger) {
this.logger = logger;
this.logger.setLevel(Level.ALL);
} |
adc4732e-8147-4d71-bbe4-0b1342f5100a | 4 | private void analysisInteraction() {
Enumeration<PhysObject3D> e = world.getObjects();
int i = 0;
PhysObject3D temp;
while(e.hasMoreElements()) {
temp = e.nextElement();
if(temp instanceof HasMassInterface) {
gravityInteraction[gravityInteraction[numObjs]] = i;
gravityInteraction[numObjs]++;
i... |
bfaf91cd-b249-4be1-a859-b00d8e712ab1 | 3 | public static ArrayList<String> getInput(String filename)
{
ArrayList<String> entry = new ArrayList<String>();
try {
BufferedReader reader = new BufferedReader(new FileReader(filename));
String line = reader.readLine();
while(line != null) {
entry.... |
8def89ba-13f8-465c-9980-9a0c88ed6af0 | 9 | public void controlarComandoRecebido(Jogada jogada) throws PecaAlheiaException, MovimentoInvalidoException, CaminhoBloqueadoException, CasaVaziaException, CapturaInvalidaPecaInexistenteException, CapturaInvalidaPecaPropriaException {
switch (jogada.getTipoJogada()) {
case MOVIMENTO:
... |
9e6f1ad1-40fd-45a6-a7ef-780ee6fa12eb | 1 | public static GameQueues getInstance(){
if(instance == null){
instance = new GameQueues();
}
return instance;
} |
5f254e6f-4308-4203-993c-e211095f9eac | 8 | public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Triplet)) return false;
@SuppressWarnings("unchecked")
final Triplet triplet = (Triplet) o;
if (first != null ? !first.equals(triplet.first) : triplet.first != null) return false;
if (second != null ? !second.equals(tripl... |
4fb0d3fe-ce9f-4309-a79b-c921ae3c1fde | 1 | public List<Product> getProductsFromBasket(int basketId) {
List<Product> list = null;
Basket basket = null;
try {
beginTransaction();
basket = (Basket) session.get(Basket.class, basketId);
list = basket.getProducts();
} catch (Exception e) {
e.printStackTrace();
} finally {
closeSession();
}
... |
74b87e5b-7092-4123-97b1-f29d5028143d | 1 | public void setBody(Body body) {
if(this.body != null){
this.body.setUsed(false);
}
this.body = body;
this.body.setUsed(true);
} |
65707862-b2c4-4a79-b5db-80169f6aa62c | 6 | protected static Set<Point> getSortedPointSet(Point[] points) {
final Point lowest = getLowestPoint(points);
if (lowest == null) {
return null;
}
TreeSet<Point> set = new TreeSet<Point>(new Comparator<Point>() {
@Override
public int compare(Poi... |
2a47d718-b933-4660-9e81-08c943c4b0b6 | 9 | private static double toDouble(Object value)
{
if (value instanceof Number) {
return ((Number)value).doubleValue();
}
else if (value instanceof String) {
return ScriptRuntime.toNumber((String)value);
}
else if (value instanceof Scriptable) {
... |
29567568-fc3d-402f-ac09-4769cd366885 | 5 | public void mousePressed(int mx, int my, GUIComponent component) {
if (component instanceof CardComponent && component.belongsTo(playersComponent) && ((CardComponent) component).getAssociatedPlayer() instanceof HumanPlayer) {
if (selectedCardComponent != component && selectedCardComponent != null) {... |
b8521f28-a96c-4cf3-ac60-2002088e4dba | 3 | public String makeString(Double make){
if(make>=1000000000) {
return df.format(make/1000000000)+"b"; }
else if(make>=1000000) {
return df.format(make/1000000)+"m"; }
else if(make>=1000) {
return df.format(make/1000)+"k"; }
return df.format(make);
} |
0854c131-dce3-4455-80b8-933f400aceaa | 7 | public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof MatrixSeries)) {
return false;
}
MatrixSeries that = (MatrixSeries) obj;
if (!(getRowCount() == that.getRowCount())) {
return false;
}... |
acd7c51f-7f0b-4f7a-a163-424a2b6a51f5 | 3 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
final WordCount other = (WordCount) obj;
return Objects.equal(this.word, other.word);
} |
5acfe8b1-1805-438a-a12f-6634864db836 | 7 | @Override
public void sessionOpened(IoSession session) throws Exception {
final String address = session.getRemoteAddress().toString().split(":")[0];
if (BlockedIP.contains(address)) {
session.close();
return;
}
final Pair<Long, Byte> track = tracker.get(addr... |
5f239440-e4be-47b3-a79e-0819906814b9 | 6 | static private void validate(Team team) {
if (team == null) {
throw new IllegalArgumentException("team is null");
}
if (team.getName() == null || team.getName().isEmpty()) {
throw new ValidationException("no name");
}
if (team.getCoach() == null || team.ge... |
ba938df6-9bca-4e06-a381-46cd657c41b1 | 6 | public static BigInteger nCrBigInt(int n, int r) {
if (r > n || r < 0) {
return BigInteger.ZERO;
}
if (r == 0 || r == n) {
return BigInteger.ONE;
}
if (r > n / 2) {
// As Pascal's triangle is horizontally symmetric, use that property to reduce the for-loop below
r = n - r;
}
BigInteger valu... |
baae3303-9883-4511-b051-e706d045120c | 8 | public static char rightOf(char direction){ //determine the direction to the right of this one
switch(direction){
case '1':
return '4';
case '2':
return'1';
case '3':
return '2';
case '4':
return '7';
case '6':
return '3';
case '7':
return '8';
case '8':
return '9';
case '9':
... |
5986a170-b8df-4c31-8e67-2c3ae4fd297d | 5 | public void assign(Rectangle rect, V value)
{
if (!split) {
values.put(rect, value);
color = true;
return;
}
if (tl.intersects(rect)) {
tl.assign(rect, value);
}
if (tr.intersect... |
8e30d61c-ced4-4920-9a10-54628f18d77a | 3 | private void func_28214_a(File var1, String var2, File var3) {
File var4 = new File(var1, var2);
if(var4.exists() && !var4.isDirectory() && !var3.exists()) {
var4.renameTo(var3);
}
} |
91eee54b-ce00-42c8-b52c-870df195f0d7 | 6 | private void inputHandling() {
if(Keyboard.isKeyDown(Keyboard.KEY_SPACE) && !spaceWasPressed){
Mouse.setCursorPosition(Display.getWidth()/2, Display.getHeight()/2);
Mouse.setGrabbed(!Mouse.isGrabbed());
spaceWasPressed = true;
}
else if(!Keyboard.isKeyDown(Keyboard.KEY_SPACE)){
sp... |
4ee2fb6c-670a-4e92-b69b-f2484bd75733 | 0 | public static <E> Iterator<E> toIterator(Enumeration<E> enumeration) {
return new EnumerationIterator<E>(enumeration);
} |
cc986cd6-76fc-4682-8849-1f0345dcdd9a | 1 | public static void main(String[] argsv) {
// Setting op a bank.
Bank christmasBank = new Bank();
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(100)));
christmasBank.addAccount(new BankAccount(BigInteger.valueOf(50), BigInteger.valueOf(-1000)));
// Print the balanc... |
474c540a-01f5-4441-bb1a-95d046b4c499 | 9 | private String readByteArray() {
StringBuffer buf = new StringBuffer();
int count = 0;
char w = (char) 0;
// read individual bytes and format into a character array
while ((this.loc < this.stream.length) && (this.stream[this.loc] != '>')) {
char c = (char) this.stream... |
0b23649a-70f1-41be-9184-e0cbec204546 | 2 | public Map load(String name) throws MapNotFoundException {
Map m = null;
if(!mapMap.containsKey(name)){
throw new MapNotFoundException();
}
else{
File f = new File(mapMap.get(name));
try {
m = (Map) biIn.load(f);
} catch (IO... |
c125aa20-728c-4ec9-abab-93b8ac555e74 | 6 | public static void manageStudents() {
System.out.print("Do you want to add (0) or delete (1) a student ? ");
int res = -1;
while (res < 0 || res > 1) {
Scanner sc = new Scanner(System.in);
res = sc.nextInt();
}
switch (res) {
case 0:
createStudent();
break;
case 1:
if (FileReadService.sL... |
7c449cd5-1fb1-4d41-8565-38ec2541bfca | 1 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
subExpressions[0].dumpExpression(writer, getPriority() + 1);
writer.breakOp();
writer.print(getOperatorString());
writer.print(objectType ? "null" : "0");
} |
3a192119-91ce-479b-bc66-d729233d91a2 | 3 | public List listUsers() {
Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List result = session.createQuery("from User u where u.username = :username and u.id = :id").setParameter("username","lisi").setParameter("id",2L).list();
sessio... |
0ddb0aea-b83f-4d38-bbda-2fe2edadc6d7 | 3 | public static String[] getList(int pageNumber)
{
String[] line = new String[PAGE_LINES];
int temp = 0;
if(pageNumber > 1) {temp = PAGE_LINES * (pageNumber - 1);}
for(int i = 0; (i < PAGE_LINES); i++)
{
if(temp >= list.size()) break;
line[i] = list.get(temp);
temp++;
}
return line;
} |
a752417b-de2e-4913-830c-ccc973d10bcc | 4 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPainelMenu = new javax.swing.JPanel();
jInserir = new javax.swing.JButton();
jEditar = new javax.swing.JButton();
jExcluir = ... |
653fe048-ea94-4aa5-a8eb-853211cbcff8 | 5 | public void acceptValuationVisitor(ValuationVisitor visitor) {
PortfolioIterator iterator = new PortfolioIterator();
Investment i;
while (iterator.hasNext()) {
i = iterator.next();
if (i instanceof Bond) {
visitor.visitBond((Bond) i);
}
else if (i instanceof Stock) {
visitor.vi... |
94b5de7d-84d5-457e-807a-000e89175822 | 2 | public static String getErrorMessage(String response) throws Exception
{
if (response == null || response.trim().length() == 0)
{
return "Null response from server";
}
Document doc = stringToXmlDocument(response);
return doc.getElementsByTagName("errortext").item(0).getTextContent().trim();
} |
b38a59fa-1cac-4328-829e-941bae2848f0 | 7 | private void changeRoomIFN() {
int doorId = room.getSquareValue(coord);
if (room.isDoorLocked(doorId)) {
return;
}
else if(doorId == -1) {
System.out.println("Door id not found at coord " + coord);
return;
}
Room nextRoom = room.getNei... |
b3843618-a0fd-4adf-8d3a-5d4bac2fdf1f | 0 | public int getVal()
{
return mySlider.getValue();
} |
85dd6fe7-2ecc-49a5-a61d-a56332bb7861 | 0 | public Points getPoints() {
return points;
} |
cef90d41-4836-4866-accf-934ab75ac8fc | 7 | @Override public void run ( ) {
final Vector<Character> chars = new Vector<Character> ( ) ;
for ( int i = 1 ; i < this.inp.length ; i++ ) {
for ( final char c : this.inp[ i ].toLowerCase ( ).toCharArray ( ) ) {
chars.add ( c ) ;
}
}
for ( final char c : chars ) {
if ( c >= 'a' ... |
f595647e-c593-4bee-968f-7e3ca3981022 | 9 | public static PreciseDecimal parse(final String s)
{
int factor = 0;
long base = 0;
int i = 0;
boolean fractional = false;
final boolean neg;
if (s.charAt(i) == '-')
{
neg = true;
i++;
}
else
{
neg = false;
}
while (i < s.length())
{
final char c = s.charAt(i++);
if (c == '.')
{
fract... |
a5baf41c-46e0-4430-93d5-4dbcab2c0053 | 4 | protected static boolean checkResource(Resource resource) {
boolean isValid;
if (isValid = resource != null) {
isValid = TYPES.contains(resource.getType());
isValid = isValid && resource.getProperty(NODES_PROPERTY) != null;
isValid = isValid && resource.getProperty(US... |
a0afed0c-378e-4a7d-92f6-05dca9908bf3 | 4 | private void update()
{
checkXp();
for(int i = 0; i < bullets.size(); i++)
{
if(bullets.get(i).isDead())
{
bullets.remove(i);
}
if(bullets.get(i) != null)
{
bullets.get(i).render();
}
}
if(isDead())
{
killEntity();
}
checkForKeyPress();
box.update(x,y,width,height... |
5f8d9372-a594-4aad-92cb-9b7036da7f05 | 1 | private void displayCommand(String command)
{
String data = textArea.getText();
while (data.endsWith("\n"))
data = data.substring(0, data.length()-1);
int lastIndex = lastCommandOffset = data.lastIndexOf("\n");
lastCommandOffset++;
data = data.substring(0,lastIndex+1) + command;
textArea.setText(d... |
c63536d8-a278-4501-a1a9-92b7d57ccd45 | 3 | public String compress(String html) {
if(!enabled || html == null || html.length() == 0) {
return html;
}
//calculate uncompressed statistics
initStatistics(html);
//preserved block containers
List<String> condCommentBlocks = new ArrayList<String>();
List<String> preBlocks = new ArrayList<String>()... |
7a6483f9-5612-43ae-a35e-d761dbac01f7 | 1 | public final void addObservable(PositionChangedObservable o) {
if(o != null)
observables.add(o);
} |
c85e1cb0-ad2a-4b72-8755-ffccd7d961ee | 2 | public void checkW(double[][] coord) {
if (coord[0][3] == 0) {
coord[0][3] = 1;
} else if (coord[0][3] != 1) {
coord[0][0] /= coord[0][3];
coord[0][1] /= coord[0][3];
coord[0][2] /= coord[0][3];
coord[0][3] /= coord[0][3];
}
} |
98f2e4b8-88a1-4dc4-b6f8-cd83702ccbfe | 8 | final private short determineElementCount() throws Exception
{
switch (type)
{
case BOOL:
case SINT:
case INT:
case DINT:
case BITS:
case REAL:
return (short) (data.capacity() / type.element_size);
case STRUCT:
{
... |
a4f9a508-920f-4d34-9c95-984fd70fb42e | 7 | public static String secondsToDHMSString(double seconds) {
if (seconds < 60) {
return doubleToString(seconds, 2, 2) + 's';
}
long secs = (int) (seconds);
long mins = secs / 60;
long hours = mins / 60;
long days = hours / 24;
secs %= 60;
mins %=... |
f5b51297-88df-4b57-807e-9b1b904f0bf0 | 9 | public static double evaluateRecall(int k, HashMap<String, HashMap<Integer,Double>> relevance_judgments,
String path){
double value = 0.0;
int countRelevance = 0;
try {
BufferedReader reader = new BufferedReader(new FileReader(path));
... |
bc199c62-3db8-43f4-aecd-0f00b24588ae | 8 | public boolean interrogateNewAgent_NETCAT_OLDER(BufferedReader brSocket)
{
try
{
String strThirdLine = brSocket.readLine();
if ((strThirdLine != null) && (strThirdLine.trim().equals("")))
{
Drivers.sop("-->>> Almost there... Confidence level is 75% ...");
sendCommand_RAW(""... |
f5c56ba5-42b3-42aa-8bdc-c94c8b3d8ca6 | 1 | public void tick() {
for (int i = 0; i < entities.size(); i++) {
entities.get(i).tick();
}
} |
e8866fde-6702-488c-96bb-fe18684b4830 | 1 | public boolean rollback(){
if(isSetForCommitting()){
session.getTransaction().rollback();
return true;
}
return false;
} |
79b0b973-385f-416c-a3a0-8eeabfd1b179 | 8 | public void nextGeneration()
{
List<LightningSegment> newSegments = new ArrayList<LightningSegment>();
int size = segments.size();
for (int i = 0; i < size; i++)
{
LightningSegment lightningSegment = segments.get(i);
if (getGeneration() == GameController.MAX_LIGHTNING_GENERATIONS)
{
segments.rem... |
3a11c456-a83b-40c9-a251-157c438640f3 | 2 | private void Remover_CampoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Remover_CampoActionPerformed
try {
if (NomeCampo_TextField2.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Indique qual o nome do campo a remover!", "Alerta!", JOptionPane.WARNI... |
3b4550c1-ea86-41db-947d-d413a60e8887 | 8 | boolean traverseGroup(boolean next) {
Control root = computeTabRoot();
Widget group = computeTabGroup();
Widget[] list = root.computeTabList();
int length = list.length;
int index = 0;
while (index < length) {
if (list[index] == group)
break;
index++;
}
/*
* It is possible (but unlikely), t... |
312fc46e-e18c-42cf-9325-72c2bfea0cd7 | 0 | public void removeAllPawns() {
pawns.clear();
currentPawn = null;
} |
85250ced-9cdf-48af-a5ae-d7b07963db68 | 6 | public void drawButton(Minecraft par1Minecraft, int par2, int par3)
{
if (this.drawButton)
{
FontRenderer var4 = par1Minecraft.fontRenderer;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, par1Minecraft.renderEngine.getTexture("/gui/gui.png"));
GL11.glColor4f(1.0F, 1.0F, 1... |
84720dee-f1e7-47c0-84db-dc2ae22c1640 | 9 | public void endScene() {
co.setX(350);
co.setY(10);
burnedVillage.setX(350);
boolean newVillage = false;
Image off = createImage(WIDTH,HEIGHT);
Graphics second = off.getGraphics();
CloudObject text1 = new CloudObject(100,10,pane.getClass().getResou... |
340e1dc3-6110-42a9-9127-f5f6df1bab37 | 1 | public boolean isTheirWin()
{
return (!theirSea.fleetDestroyed() && mySea.fleetDestroyed());
} |
5ac33a4b-c878-4b68-9600-ec60a31c3b73 | 6 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int n = Integer.parseInt(line.trim());
for (int i ... |
e19c02f1-8c98-43f9-bed9-4f7721481bc6 | 3 | @Override
public boolean next() {
if (brParser == null) {
// this should not happen, throw exception
throw new RuntimeException("No parser available to fetch row");
}
if (getMetaData() == null) {
setMetaData(((AbstractParser) brParser).getPzMetaData());
... |
684cec16-adc7-4e58-8572-b1edad0189c8 | 4 | public double standardizedItemMinimum(int index){
if(!this.dataPreprocessed)this.preprocessData();
if(index<1 || index>this.nItems)throw new IllegalArgumentException("The item index, " + index + ", must lie between 1 and the number of items," + this.nItems + ", inclusive");
if(!this.variancesCal... |
1ecc4eaa-aa80-4803-969d-6f766b952406 | 8 | @SuppressWarnings("unchecked")
private static final Object[] decodeDictionary(byte[] bencoded_bytes, int offset) throws BencodingException
{
HashMap map = new HashMap();
++offset;
ByteBuffer info_hash_bytes = null;
while(bencoded_bytes[offset] != (byte)'e')
{
//... |
c8af0373-ffbb-4992-8489-0b24c00bed70 | 7 | private int decimalDigits ( double d, boolean expo ) {
if( d == 0.0 ) return 0;
d = Math.abs( d );
int e = intDigits( d );
if( expo ) {
d /= Math.pow(10, e-1);
e = 1;
}
if( e >= digits ) return 0;
int iD = Math.max(1, e);
int dD = digits - e;
if( !trailing && dD > 0 ) {... |
6123734b-2462-40ae-b3c0-e7a57c4105df | 5 | public void work() {
Iterator<ISystem> sysIter = systems.iterator();
updateTimer();
long now = now();
Collection<IEntity> entities = entitiesByID.values();
for (IEntity each : entities) {
if (each.hasChanged()) {
updateInfoPacks(each);
... |
c46ee801-f850-4c44-b2db-334394b35e3d | 9 | public static BigDecimal normalizeCycle(
Cycle<Nucleotide, InteractionEdge> ac, boolean basepaironly) {
List<Nucleotide> verts = ac.getVertexList();
LinkedList<Integer> tmpints = new LinkedList<Integer>();
for (Nucleotide aNuc : verts) {
try {
int nn = aNuc.getNormalizedNucleotide();
tmpints.add(nn)... |
5dc53e8d-43f7-44ae-bfd5-15c845505ba1 | 6 | @Override
public void bsp(
BSPPeer<NullWritable, NullWritable, NullWritable, NullWritable, NullWritable> peer)
throws IOException, SyncException, InterruptedException {
int nbRowsBlocks = nbRowsA / blockSize;
int nbColsBlocks = nbColsB / blockSize;
int nbBlocks = nbRowsBlocks * nbColsBlocks;
int b... |
d3937249-c1ad-4295-b178-12f95aee5cb0 | 5 | public boolean validate() {
if (!HAS_DAY || !HAS_TIME || !HAS_NAME) {
VALIDATED = false;
return VALIDATED;
}
if (HAS_TEACHER == false) setTeacher("Unknown");
if (HAS_ROOM == false) setRoom("Unknown");
generatePID();
VALIDATED = true;
return VALIDATED;
} |
ec315c23-9379-4ec7-bbda-6d6306f0304e | 1 | public void wdgmsg(Widget sender, String msg, Object... args) {
if(sender == cbtn) {
wdgmsg("close");
} else {
super.wdgmsg(sender, msg, args);
}
} |
606c490a-4926-4761-97d5-69c6ab49f64a | 2 | private List<SoftwareSystem> generateSystemsEP() {
List<SoftwareSystem> systems = new ArrayList<>();
for (HardwareSystem hardwareSystem : project.getHardwareSystemsEP())
for (DeploymentAlternative deploymentAlternative : project.getDeploymentAlternatives())
systems.add(new SoftwareSystem(hardwareSystem, depl... |
07f236fb-6d1d-4224-b770-2c57f3470956 | 4 | public static ArrayList<Packet> extractPacketsInfo(String file){
BufferedReader reader = null;
ArrayList<String> linesList = new ArrayList<String>();
ArrayList<Packet> packetList = new ArrayList<Packet>();
try {
reader = new BufferedReader(new FileReader(file));
String line2 = reader.readLine();
Str... |
05a379e0-dca4-44ee-a39d-1aa895859414 | 0 | @Override
public boolean supportsMoveability() {return false;} |
7ae00494-52df-43ef-a187-e7c94b4ba0f2 | 9 | @Override
public Ability[] getTimsAdjResCast(Item I, int[] castMul)
{
Ability A;
final Ability[] RET=new Ability[3]; // adj, res, cast
castMul[0]=1;
for(int i=0;i<I.numEffects();i++)
{
A=I.fetchEffect( i );
if(A instanceof TriggeredAffect)
{
final long flags=A.flags();
final int triggers=((... |
cdef7b10-560a-4b11-bb49-04413450b0e2 | 1 | public void testWithFieldAdded5() {
TimeOfDay test = new TimeOfDay(10, 20, 30, 40);
try {
test.withFieldAdded(DurationFieldType.days(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
608fa571-f2df-4412-acc2-2c3c807bba51 | 6 | public static LinkedListNode findLoop(LinkedListNode head){
LinkedListNode fast=head;
LinkedListNode slow=head;
// boolean loop=false;
while(fast != null && fast.next != null){
fast=fast.next.next;
slow=slow.next;
if(fast==slow){
// loop=true;
break;
}
}
if(fast == null || fast.next ... |
312b6482-de6e-4cad-b618-44b4e37bc353 | 6 | public void pauseObjects(){
if (player1 != null)
player1.pause();
if (player2 != null)
player2.pause();
for (Asteroid asteroid: asteroids)
asteroid.pause();
for (Bullet bullet: bullets)
bullet.pause();
if (alienShip != null)
alienShip.pause();
if (rogueSpaceship != null)
rogueSpaceship.pau... |
d6198741-e71b-4492-bdcf-fc3e8573b263 | 4 | @SuppressWarnings("unchecked")
@Override
public int compare(Column column, Row one, Row two) {
Object oneObj = one.getData(column);
Object twoObj = two.getData(column);
if (!(oneObj instanceof String) && oneObj.getClass() == twoObj.getClass() && oneObj instanceof Comparable<?>) {
return ((Comparable<Object>)... |
aa179178-2ed3-42e5-8a5e-e3a414c6187e | 3 | public double[] getInitConcns(){
if(!this.psi0set && !this.sigmaSet)unpack();
double[] conc = Conv.copy(this.initConcn);
for(int i=0; i<this.numOfIons; i++)conc[i] *= 1e-3;
return conc;
} |
5e533ae6-f51d-4594-95ac-2739d697e592 | 2 | public boolean isBlockedByTanq(int x, int y, int width, int height) {
synchronized (tanqs) {
for (Tanq t: tanqs) {
if (t.isTouching(new Vector3D(x, y, 0), (int)Math.sqrt(width * width + height * height)))
return true;
}
}
return false;
} |
70f0393a-cdfd-4bf4-ae5d-e6505a97193d | 4 | public void checkType(Symtab st) {
exp1.setScope(scope);
exp1.checkType(st);
exp2.setScope(scope);
exp2.checkType(st);
if (!exp1.getType(st).equals("int")
&& !exp1.getType(st).equals("decimal")) {
Main.error("type error in minus!");
}
if (!exp2.getType(st).equals("int")
&& !exp2.getType(st).equ... |
84d39a4f-84b6-41fd-8afb-28531732b1ed | 3 | public void addItem(Time item)
{
if ((!items.contains(item)) && (!item.equals(emptyTime)))
{
items.add(0, item);
}
if (items.size() > maxItems)
{
items.remove(items.size() - 1);
}
} |
4e723fc0-ffff-4434-980d-c317329644ef | 1 | private void setAttr(Attributes attr) {
// atributo 'nome'
if (attr.getIndex("nome") >= 0) {
this.nome = attr.getValue("nome");
} else {
System.out.println("BD: Faltando o atributo 'nome'");
}
} |
c908595c-bf35-4e74-99e6-691ea6be6487 | 9 | public void step()
{
log.debug("============== Stepping "+tam.getId()+" currentState "+currentState+ " ================");
switch (getState())
{
case READ_ID:
if(tam.isRobotPresent()){ // if there is a robot in the tam
//try to read a value from it
... |
c22468ec-3797-4145-8cdb-1073288c1fa4 | 2 | public void deposit(BigInteger amount) throws IllegalArgumentException {
if ( (amount == null) || (amount.compareTo(BigInteger.ZERO) <= 0) )
throw new IllegalArgumentException();
setBalance(this.getBalance().add(amount));
} |
101c7a2f-532f-4519-883d-882d3a5cad67 | 4 | public QuadTreeNode getChild(Position pos){
switch (pos){
case northWest: return nw;
case northEast: return ne;
case southWest: return sw;
case southEast: return se;
default: return null;
}
} |
531d0b65-2141-4327-98d5-11a9eacf4a6b | 9 | public Object setValue(Object ctx, Object elCtx, VariableResolverFactory variableFactory, Object value) {
// this local field is required to make sure exception block works with the same coercionRequired value
// and it is not changed by another thread while setter is invoked
boolean attemptedCoercion = co... |
61e88eb0-f38f-4e1f-8d66-af36ae0b9240 | 0 | public CheckResultMessage checkSheetFormat() {
return report.checkSheetFormat();
} |
f62975f3-3ddc-43ee-b4e6-9b88f8235f54 | 1 | private boolean isPossibleToPlaceDiagRightAbove(int position, int dimension, int positionRightAbove) {
return elementDiagonallyRightAbove(dimension, position, positionRightAbove) >= 0
&& (elementDiagonallyRightAbove(dimension, position, positionRightAbove)) % dimension < dimension - 1;
} |
e868c6cc-f955-4419-8ef8-2898e2343e84 | 8 | public static int mss(String dna1, String dna2, boolean print) {
int[][] matrix = new int[dna2.length() + 1][dna1.length() + 1];
int i = 0, j = 0;
for(;i<=dna2.length();i++)
matrix[i][0] = i;
for(;j<=dna1.length();j++)
matrix[0][j] = j;
for(i=1;i<=dna1.length();i++) {
for(j=1;j<=dna2.length();j++) ... |
4026d07c-7547-44b5-98e2-52cdbb4b07f3 | 2 | public List<Group> getGroupList(int schedule)
{
List<Group> list = new ArrayList<Group>();
try {
ResultSet rs = con.createStatement().executeQuery( "SELECT * FROM groups WHERE schedule=" + schedule );
while(rs.next())
{
list.add(getGroupFromRS(rs));
}
rs.close();
} catch (SQLExcepti... |
6a1487b1-8699-43a6-9b0f-2c415f3bc3fe | 3 | public int[] molecularSizeDistrb(){
int maxSize=0;
for (int i=0; i<bucket.size(); i++){
maxSize = (bucket.get(i).getSize() > maxSize)? bucket.get(i).getSize() : maxSize;
}
int[] sizeDistrb = new int[maxSize+1];
for (int i=1; i<bucket.size(); i++){
sizeDistrb[bucket... |
8853a7a5-a5ed-4d9c-b80b-758a2b34d10e | 0 | public String getNick() {
return _nick;
} |
1032e5e8-d61e-41cf-b7e7-a29e45e9eb10 | 4 | public boolean setPath(String p) {
boolean test = false;
if (test || m_test) {
System.out.println("FileManager :: setPath() BEGIN");
}
m_path = p;
if (test || m_test) {
System.out.println("FileManager :: setPath() END");
}
return true;
} |
c2bcf445-a0da-4ec7-9f09-e1e22fd782a8 | 1 | public static void createNetGame(Socket Toserv, ObjectOutputStream out, ObjectInputStream in, String user)
{
try
{
AppGameContainer app = new AppGameContainer(new GameFrame(Toserv, out, in, user));
app.setDisplayMode(viewW, viewH, false);
app.setVSy... |
a6dfa34e-e865-467d-8ddf-04b2dcbe4cde | 0 | @Override
public void lostOwnership(Clipboard clipboard, Transferable contents) {
} |
51da35ce-bd30-46a1-9ad4-48001a51020c | 3 | @SuppressWarnings("unchecked")
@Override
protected Class<? extends Number> translateReturnType(Class<?> clazz)
{
//no widening used for Minimum
return (Class<? extends Number>) clazz;
} |
8b707015-ad8e-466d-9c96-b9f8357dcba4 | 1 | public Image loadImage(String image){
try {
return Toolkit.getDefaultToolkit().createImage(image);
} catch (Exception e) {
e.printStackTrace();
}
return null;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.