method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7d074729-05f8-4d94-875d-5eae86ba14d4 | 9 | private int bestMove(int rm,int rw, int pm, int pw, int sm, int sw){
int bestMove = 0;
ArrayList<Double> move = new ArrayList<>();
if(rm!=0||rw==0){
move.add((double)rw/(double)rm);
}
if(pm!=0||pw==0){
move.add((double)pw/(double)pm);
}
if(... |
7164b4f9-ae70-4708-b447-3b0f91d38246 | 0 | @Test
public void validaNome(){
assertTrue("Valida nome: ", validadorUsuarios.validaNome("ams") == true);
} |
834b1e46-ca46-4cb7-b912-da3c492f6723 | 8 | private void readFrames(LittleEndianInputStream in, int ver)
throws IOException {
int numPoints = in.readUnsignedShort();
int alpha = 0;
if (ver == 8) {
switch (in.readShort()) {
case 0: break;
case 1: alpha = 1; break;
case 0x101: alpha = 4; break;
default: throw new FileFormatException("Unknow... |
880f63ac-ab93-44e4-87fa-27ab32efb2d9 | 2 | public void setWindowBorderthickness(int[] border) {
if ((border == null) || (border.length != 4)) {
this.window_Borderthickness = UIBorderthicknessInits.WINDOW.getBorderthickness();
} else {
this.window_Borderthickness = border;
}
somethingChanged();
} |
2377e570-ac5a-4ea8-b6fb-ede1fd694ca7 | 5 | @Override
public void paint(Graphics g) {
locationImg = CreateGUI.returnInstance().createImageIcon("img/location.png", "Location");
Graphics2D g2 = (Graphics2D) g;
paintComponent(g2);
if(dragging) {
g2.setColor(Color.RED);
if(rectWidth/rectHeight < preferredRatio) {
rectWidth = rectHeight * preferred... |
6ab128dc-ed3b-47d1-ace6-f97872510ea2 | 7 | private boolean checkForWinHorizontal() {
for (int i = 0; i < COL_COUNT; i++) {
Cell cell4 = arrayOfLogicCells[0][i];
Cell cell5 = arrayOfLogicCells[1][i];
Cell cell6 = arrayOfLogicCells[2][i];
if (cell4.isZeroChecked() && cell5.isZeroChecked()
... |
36f8974d-c8b7-4dbb-94c9-4857f44e32a6 | 3 | public void writeTextFile(String fileName, String s) {
FileWriter output = null;
try {
output = new FileWriter(fileName);
BufferedWriter writer = new BufferedWriter(output);
writer.write(s);
writer.close();
} catch (IOException e) {
e.... |
2bea7919-3c3b-423f-8b50-fd8df2bfafab | 5 | public boolean writeWorld(String fileName) {
try {
worldWriter = new BufferedWriter(new FileWriter(fileName));
worldWriter.write(Integer.toString(rows));
worldWriter.newLine();
worldWriter.write(Integer.toString(columns));
worldWriter.newLine();
for (int i = 0; i < rows; i++) {
String currentLin... |
0480ab7b-0e27-4e4b-8bfb-a0565e9d35eb | 0 | public boolean equals(VertexSet that){
return this.cityMap.keySet().equals(that.cityMap.keySet());
} |
ec3532fe-c2a9-46be-aba3-7ff02896468e | 9 | public final void update() {
++chunkUpdates;
int var1 = this.x;
int var2 = this.y;
int var3 = this.z;
int var4 = this.x + this.width;
int var5 = this.y + this.height;
int var6 = this.z + this.depth;
int var7;
for(var7 = 0; var7 < 2; ++var7) {
this.dirty[va... |
ddd0f47c-3282-4d44-b736-5dd9c2e1ad59 | 6 | private synchronized void checkWinCondition() {
int playersWithMoney = 0;
int winningPlayer = -1;
for(int i = 0; i < players.size(); i++) {
if(players.get(i).getMoney() > 0 || players.get(i).getProperty().size() > 0) {
playersWithMoney++;
// No one has won yet
if(playersWithMoney > 1) {
... |
a62ba130-1e76-48d2-9e1b-97ec003fb107 | 3 | public void drawPiece( int lx, int ty, float red,
float green, float blue, Graphics screen)
{
Color newColor = new Color(red, green, blue);
Color newBorder = new Color( (red > 0.5f) ? red - 0.5f : red,
(green > 0.5f) ? green - 0.5f : green,
(blue > 0.5f) ? blue - 0.5f : blue);
screen.s... |
8c549271-eaba-4782-853c-b4f2cc3e821c | 8 | public boolean hasPrev()
{
if (currentPiped == null)
return false;
else if (currentPiped.hasPrev())
return true;
else if (previousPiped != null)
return previousPiped.hasPrev();
else if (!in.hasPrev())
return false;
else while (true)
{
// TODO - This is not the optimal way to do things,
/... |
364b815f-1844-4208-b4f1-6ce776cc44ff | 2 | public static HelloCorba.Hello unchecked_narrow (org.omg.CORBA.Object obj)
{
if (obj == null)
return null;
else if (obj instanceof HelloCorba.Hello)
return (HelloCorba.Hello)obj;
else
{
org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ... |
295d6c94-e302-4802-9073-434aea89bd66 | 1 | public boolean setLoadingStatusWidth(int width) {
boolean ret = true;
if (width <= 0) {
this.loadingStatusWidth = 0;
ret = false;
} else {
this.loadingStatusWidth = width;
}
somethingChanged();
return ret;
} |
1d40f2e1-1bb9-4b5a-9eb7-5e8f9e2dfd1f | 9 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
State other = (State) obj;
if (position == null)
{
if (other.position != null)
return false;
} else if (!position.equals(other.positi... |
4ef094f6-56e9-424d-a2f5-83cdc04b139b | 6 | public void setCriteriaHightlight(int type) {
HashMap<String, Integer> ranks = null;
if (type == CriteriaStatistics.PRODUCT)
ranks = rankVarianceScore();
else if (type == CriteriaStatistics.WEIGHT)
ranks = rankVarianceWeight();
else if (type == CriteriaStatistics.... |
a4b011f3-1bb0-4a89-a015-c84bb16e81d3 | 1 | public void shoot(Point2D direcVect) {
if(direcVect != null){
adjustVect = SPEED_NORME / (Math.sqrt(Math.pow(direcVect.getX(), 2) + Math.pow(direcVect.getY(), 2)));
speedX = (float) (direcVect.getX() * adjustVect);
speedY = (float) (direcVect.getY() * adjustVect);
}
else{
speedX = DEFAULT_SPEEDX;
s... |
66b10d77-6830-4cc4-8213-e4ceb06cd37b | 5 | private int[] findErrorMagnitudes(GenericGFPoly errorEvaluator, int[] errorLocations) {
// This is directly applying Forney's Formula
int s = errorLocations.length;
int[] result = new int[s];
for (int i = 0; i < s; i++) {
int xiInverse = field.inverse(errorLocations[i]);
int denominator = 1;... |
e5600e8b-06f6-4c45-8269-18c1e7fd2fb8 | 8 | public boolean isPoweringTo(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
{
if (!this.isRepeaterPowered)
{
return false;
}
else
{
int var6 = getDirection(par1IBlockAccess.getBlockMetadata(par2, par3, par4));
return ... |
91840fdf-697c-4547-bf60-017e81077725 | 9 | private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
Point eventP = e.getPoint();
int layer = -1;
int number = 0;
for (int i = 0; i < ffnn.getLayers().size(); i++) {
if (layer != -1)
break;
for (int j = 0; j < ffnn.getLayers().get(i)
.getNeuronCount(); j++) {
... |
186f6c98-3f28-41a8-83e3-85b03162e938 | 4 | public boolean subclassOf(CtClass superclass) {
if (superclass == null)
return false;
String superName = superclass.getName();
CtClass curr = this;
try {
while (curr != null) {
if (curr.getName().equals(superName))
return true;... |
97ac695a-cfb7-4015-88d2-6ede9afd1f0f | 6 | public static StructureBoundingBox findValidPlacement(List par0List, Random par1Random, int par2, int par3, int par4, int par5)
{
StructureBoundingBox var6 = new StructureBoundingBox(par2, par3, par4, par2, par3 + 2, par4);
if (par1Random.nextInt(4) == 0)
{
var6.maxY += 4;
... |
a7532f39-42c1-4097-9fc9-510a7399529d | 0 | public String getTitle() {
return this.title;
} |
fdcad65f-16f6-4724-95e4-3763cb2776b4 | 0 | public KeyStroke getKey() {
return KeyStroke.getKeyStroke('s');
} |
9c65eec0-b549-40df-a315-cc06bd250c6b | 9 | public void scrollCellToView(JTable table, int rowIndex, int vColIndex) {
if (!(table.getParent() instanceof JViewport)) {
return;
}
JViewport viewport = (JViewport) table.getParent();
Rectangle rect = table.getCellRect(rowIndex, vColIndex, true);
Rectangle viewRect =... |
80954f2b-f300-4166-b2c0-adb9861cab36 | 6 | private double turnTo(double direction, double tickTime){
double dirDiff = direction - head.rotation;
while(dirDiff < -180f) dirDiff += 360f;
while(dirDiff > 180f) dirDiff -= 360f;
double sign = Math.signum(dirDiff);
// already done?
if(dirDiff * sign <= 0.5d){
headVel = 0d;
return 0d;
}
// alread... |
8d61cadd-1e78-4e53-8461-1d584abf3b9e | 8 | private void calculate() {
/* Calculating thing */
int last = 0;
int level = 0;
Set<ControlNode> calculated_lines = new HashSet<>();
for (int k = 0; k < nested.algorithm.size(); k++) {
/* Searching thru all the ControlNodes... */
if (nested.algorithm.get(k) instanceof ControlNode) {
ControlNode c... |
b85f1798-2c7b-4c36-abf9-5c711c0e4c88 | 3 | public void add(E o) {
checkForComodification();
lastReturned = head;
if(next == null) { // append to the end of the list
if(append(o)) {
expectedModCount++;
}
} else {
if(addBefore(o, next)) { // returns true if successfully inserted
nextIndex++;
expectedModCount++;
}
}
... |
5dc24e46-c790-4e04-92ff-2d8f01b6efb3 | 2 | private void loadStudy(Study study) {
// Do nothing if nothing selected.
if(study == null)
return;
// Get previous display state.
DisplayState state = study.getDisplayState();
if(state == null) // No previous display state
MedImage.getIma... |
dbdca19e-709a-4754-9de7-a982afad86b4 | 1 | public boolean opEquals(Operator o) {
return (o instanceof ThisOperator && ((ThisOperator) o).classInfo
.equals(classInfo));
} |
b9ec2b3e-8316-4a0b-9a0c-ba69e54bc881 | 8 | public BatchPane()
{
frame = Frame.getInstance();
setLayout(null);
FileFilter filter = new FileTypeFilter(".data", "Text files");
dataChooser = new JFileChooser();
dataChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
dataChooser.setFileFilter(filter);
FileFilter filter2 = new FileTypeFilter... |
52ef0c04-8af8-485f-8a1a-ef051156f853 | 6 | public double[] predictDistribution() {
int[] fruitCounts = new int[12];
int totalFruit = 0;
double[] fruitProbabilities = new double[12];
for (int i = 0; i < firstRoundBowlHistory.length; i++) {
for (int j = 0; j < firstRoundBowlHistory[i].length; j++) {
fru... |
95f517b5-6bc7-4649-b0fd-a80e0ec4f20d | 2 | public JSONObject getData() {
JSONObject o = new JSONObject();
try {
for (Resource r : Resource.values()) {
o.put(r.name(), getF(r));
}
} catch (JSONException e) {
e.printStackTrace();
}
return o;
} |
480a1343-23ff-4407-8986-5bb7a1e2ee88 | 6 | private boolean upToDate (File verFile) {
boolean result = true;
try {
if (!verFile.exists()) {
verFile.getParentFile().mkdirs();
verFile.createNewFile();
result = false;
}
BufferedReader in = new BufferedReader(new File... |
2e554fcc-e754-4874-8105-affdebc2b00c | 7 | public Vector<WorldMap> readMaps()
{
try
{
BufferedReader reader = new BufferedReader(new FileReader(mapFilename));
WorldMap wm = null;
String line = reader.readLine();
while (line != null)
{
line = line.toUpper... |
c20b0e16-7a0f-4674-a41b-f9c9023f3e34 | 9 | private void cycleFocusLevel(boolean next) {
if (next) {
// Next View to focus should be the first child View of the currently focused View. If there is no such View, the currently focused View should be clicked on.
List<View> focusableViews = getNextFocusableViews(next);
if ... |
715a6d33-a583-4c63-b79a-4b8de1bad599 | 5 | public void write(VariableMap vars, File target) {
this.vars = vars;
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
dbfac.setValidating(false);
dbfac.setNamespaceAware(true);
DocumentBuilder docBuilder;
try {
docBuilder = dbfac.newDocumentBuilder();
//docBuilder.setErrorHandl... |
29da1fbd-5494-420b-ac98-cf6160b7ba78 | 3 | public boolean removeNick(String nick) {
if (nicks.contains(nick)) {
nicks.removeElement(nick);
char c = nick.charAt(0);
switch (c) {
case '@': beginningVoiced--;
case '+': beginningNormal--;
default: count--;
}
return true;
} else
return false;
} |
ad5f75c0-3136-4a25-84af-10e6dc43ebfc | 3 | public boolean[][] getPassableMap() {
final boolean[][] result = new boolean[getMapHeight()][getMapWidth()];
final byte[] bytes = ((DataBufferByte) mapImage.getRaster().getDataBuffer())
.getData();
final int w = getMapWidth();
final int h = getMapHeight();
for (int row = 0; row < h; row++) {
final int ... |
25845758-32d2-4025-ad96-d14f809475ce | 7 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical target, boolean auto, int asLevel)
{
if(!auto)
return false;
final Physical P=target;
if(P==null)
return false;
if((P instanceof Item)&&(room==null))
return false;
if(P.fetchEffect("Falling")==null)
{
final Falling F=new ... |
ed9621a4-099a-4692-be3e-1629b810cf5f | 7 | public static String safeReverseTranscribe(String inString ) throws
Exception
{
StringBuffer buff = new StringBuffer();
for ( int x= inString.length() - 1; x >=0; x-- )
{
char c = inString.charAt(x);
if ( c == 'A' )
buff.append( 'T' );
else if ( c == 'T' )
buff.append( 'A' );
els... |
79beb80b-a711-44dc-90d5-9e97fd30409e | 1 | public void pokemonFinalStats(int pokeDmg, double atkPercent,
double defPercent) {
GameFile.pokemonFullHp[0] = (int) (((double) ((GameFile.pokemon1Ivs[0]
+ (2 * baseHp) + 100) * GameFile.pokemonLevels[0]) / 100) + 10);
statAtk = (int) ((((double) ((GameFile.pokemon1Ivs[1] + (2 * baseAtk)) * GameFile.pokemonL... |
d72b1072-2765-4b7e-adad-e35d824c8c99 | 6 | public void resetTo(String contig, int leftEdgePos) throws IOException, EndOfContigException, FullQueueException {
if (reader.getCurrentContig() == null) {
reader.advanceToContig(contig);
}
if ((! reader.getCurrentContig().equals(contig))) {
bases.clear();
this.leftEdge = 1;
reader.advanceToContig... |
ee8a81d5-95b1-4006-ab79-041def69a277 | 8 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
try {
if (txtDNI_Agricultor.getText().compareTo("") != 0
&& txtNombres_Agricultor.getText().compareTo("") != 0
&& txtApePaterno_Agricultor.getTe... |
d55e1094-df6c-48a8-a0f2-1b001f6979ab | 9 | public List<Attempt> solve() {
ArrayList<Attempt> successes = new ArrayList<Attempt>();
if (isMetGoal()) {
successes.add(this);
} else if (isGoodAttempt()) {
int moveIndex = -1;
for (int i = 0; i < moves.length; i++) {
if (null == moves[i]) {
... |
438bfb4c-a4a9-439e-8c9d-b224f08dc851 | 5 | @Override public void init() {
signalTower = SignalTowerBuilder.create().build();
count = 0;
lastTimerCall = System.nanoTime();
timer = new AnimationTimer() {
@Override public void handle(long now) {
if (now > lastTimerCall + 2_000_000_000l) {
... |
d8e8c368-d952-4658-8b18-012e68345f32 | 1 | public boolean modifyStudent(String originNo, Student now) {
String select = "SELECT * FROM STUDENT WHERE NO=?";
try {
PreparedStatement ps = conn
.prepareStatement(select, ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ps.setString(1, originNo);
ResultSet rs = ps.executeQuery();... |
827f088b-a95b-46b2-8ffa-9e44bbca712a | 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... |
9bb2276b-b517-484b-9d6d-d9ce861b398c | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
if (login != null ? !login.equals(user.login) : user.login != null) return false;
if (password != null ? !password.equals... |
d4866ed0-5e82-4ac2-bd9c-e0274f608c9a | 7 | public void update(InputHandler inHandler) {
// movement
setX_Point(getX_Point()-getxVel());
setY_Point(getY_Point()+getyVel());
if(isGravityOn()){
updateGravity();
if(getY_Point()>getHeight()){
setyVel(getyVel()-upAc);
}
}
// "droping"
if(getDropTimer().isReady()){
setDropTimer... |
4ad557fe-6484-473d-b5ef-a95498820546 | 9 | @Override
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException
{
dispatchHotkeys(container, delta);
if (currentState == STATE_DEAD || currentState == STATE_PAUSED) {
return;
}
map.update(this, container, delta);
// detect tower ... |
7a45e16b-1db7-4bb0-aca8-c250623bc9db | 6 | private static void showResults(HuntField field) {
int counter = 0;
for (FieldItem item : field.getItemsInField()) {
if (item.getType() == 'H') {
counter++;
Hunter hunter = (Hunter) item;
switch (hunter.hunted()) {
case 0:
... |
7a08059f-9631-4285-a9db-2ee682505674 | 0 | private void drawBackground() {
g.setColor(Color.cyan);
g.fillRect(0, 0, WIDTH*SCALE, HEIGHT*SCALE);
} |
f36b2bff-ac3d-448f-afff-89003be729fd | 2 | public int getVisibleColumnCount() {
int count = 0;
for (Column column : mColumns) {
if (column.isVisible()) {
count++;
}
}
return count;
} |
d6dc2d09-0450-415f-948b-4cb4ad9a979c | 6 | public static void main(String[] args) throws Exception {
String map = null;
//String group = null;
if (args.length > 0)
map = args[0];
if (args.length > 1)
L = Double.parseDouble(args[1]);
if (args.length > 2)
W = Double.parseDouble(args[2]);
if (args.length > 3)
gui = Boolean.parseBoolean(args... |
3c6c230e-edd0-44e6-b80c-c8f8c41e1cff | 9 | private void extend(ITNode currNode) throws IOException {
// loop over the brothers of that node
int i = 0;
while (i < currNode.getParent().getChildNodes().size()) {
// get the brother i
ITNode brother = currNode.getParent().getChildNodes().get(i);
// if the brother is not the current node
if (brother... |
931b4d5a-ec2d-461b-a0e0-3b90b958e36b | 1 | public static void main(String[] args) {
try {
int port = Integer.parseInt(args[0]);
new ChatServer(port);
} catch (Exception e) {
System.out.println("Enter a valid port.");
System.exit(0);
}
} |
f93e45c9-583d-474b-836a-d4135c7ed671 | 4 | public void eat() throws GameException
{
ArrayList<Actor> intersectingObjects = (ArrayList<Actor>) getIntersectingObjects(MovingObject.class);
if(intersectingObjects.isEmpty())
return;
for(int i=0; i < intersectingObjects.size(); i++)
{
MovingObject chosenActor = (MovingObject)intersec... |
8ad0f29f-a031-4929-b13b-3ecdc2f1d6a1 | 6 | public void passKeyPressed(ArrayList<KeyButtons> keyPressed)
{
if (!keyPressed.isEmpty() && keyPressed != null);
{
switch (whatcha)
{
case PLAYING:
stage.handlePressedKeys(keyPressed);
break;
case PAUSE:
... |
381c5db1-fa19-4c17-825b-3749b831a55c | 5 | @Override
public double getIntersectionValue(Ray ray)
{
//sphere: r^2 = (x - x1)^2 + (y - y1)^2 + (z - z1)^2
//Line: x = at + b
// y = ct + d
// z = et + g
LinearEquation combinedX = LinearEquation.Add(ray.xEquation, -center.x);
LinearEquation combinedY = LinearEquation.Add(ray.yEquation, -c... |
f0c7e271-bc07-4132-848e-ceaf80619044 | 8 | private int getCompositeNum() {
int n = 1;
List<Integer> primes = new ArrayList<>();
while ((n += 2) > 0) {
boolean isPrime = Problem3.isPrime(n);
if (isPrime) {
primes.add(n);
continue;
}
boolean hit = false;
for (int i = primes.size() - 1; i >= 0; i--) {
int p = primes.get(i);
int... |
873cc45b-ad0b-455d-b78f-727d98ac305d | 7 | private void set2(Delegate d) {
setVisible(d.visible);
setDraggable(d.draggable);
setRx(d.getX());
setRy(d.getY());
setAngle(d.getAngle());
setFont(d.getFont());
setFillMode(d.getFillMode());
setBorderType((byte) d.getBorderType());
setShadowType((byte) d.getShadowType());
setForegroundColor(d.getFo... |
62a999d4-5989-47f5-8986-54c7547f3d94 | 1 | @Override
public void close() {
for (int i = 0; i < printStreams.length; i++){
printStreams[i].close();
}
} |
26057333-fea9-4c42-9d57-5419c1f678c7 | 1 | @Override
public int read() throws IOException {
return (prt < data.length) ? (data[prt++]):-1;
} |
5ca85386-5c9f-4ce5-8188-5d7a85f19550 | 7 | private double compute_conductance(fgraph fg,community com)
{
double m=0,c=0;
for(int i=0;i<fg.get_number_of_edges();i++)
{
edge e=fg.get_edge(i);
if(com.contains(e.get_n1())&&com.contains(e.get_n2()))
{
m++;
}
else if((com.contains(e.get_n1())&&!com.contains(e.get_n2()))||(!com.contains(e.get... |
a7f2dca6-b7ac-4aa4-8331-c8d058d859c1 | 8 | public void analyzePath() {
addedLength = actualLongestPath.getLength();
Direction dir = board.getWaterDirection();
List<Pipe> path = actualLongestPath.getPath();
for (int i = 0; i < path.size(); i++) {
if (path.get(i).isCorner()) {
if (!replaceWithCross(path.get(i), i, dir))
if (i + 1 < path.size()... |
412850eb-d0c6-4474-b643-8d424a327c6e | 8 | public static EntityInformation serializeEntity(InternalComponentManager componentManager, EntityRef clientEntity,
int entityId, EntityRef entity, Iterable<? extends EntityComponentFieldFilter> componentFieldFilters) {
EntityInformation entityInformation = new... |
4d97f5ae-98dd-4bd1-abcd-126ce372db17 | 5 | private void rellenaAleatorio() {
for(int y=0; y<numeros.length; y++){
int min = y * 10;
int max = ((y + 1) * 10) - 1;
if(min == 0) min = 1;
if(max == 89) max = 90;
for(int x=0; x<numeros[y].length; x++){
int aleatorio = 0;
boolean repetido = true;
while(repetido){
aleator... |
e25a0b4e-6949-4ac4-99c9-c8ccbb1c1ec4 | 2 | public static double clampDouble(double value, double min, double max)
{
return (value < min) ? min : (value > max) ? max : value;
} |
889f696e-6944-49b2-8294-ad14255833ea | 4 | public void test() {
String f = "SafeCommandBlock";
PluginUpdateInfo tar = null;
for (PluginUpdateInfo pui : PluginUpdateInfo.plugins) {
if (pui.p.getDescription().getName().equals(f)) {
tar = pui;
}
}
VersionsComparer vs = new VersionsComparer(Comparer.VERSION_WEBSITE_COMPARE);
try {
System.ou... |
eef3470a-1ae9-4f8b-8c82-312ce32ad823 | 0 | public int GetTravelTime()
{
//return the travel time
return this.toLastBusStopTicks - this.firstTicks;
} |
2d177373-3c13-4f90-bb21-da96a126d5e0 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ProposedCard other = (ProposedCard) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id)
&& (a... |
46212c95-6d25-4f8c-a8b2-067a014036cf | 5 | @Override
public void onDisable() {
GcConfig.plugin = null;
GcFiles.save();
Player [] list = Bukkit.getOnlinePlayers();
for (Player players : list) {
if (GcEntityListener.signLocation.containsKey(players)) {
Block block = GcEntityListener.signLocation.get(players).getBlock();
block.setType(Material.... |
ff8fcfeb-6973-44ac-bd71-e186afb4ac0c | 1 | public final void unpause() {
if (paused.compareAndSet(true, false)) {
synchronized (this) {
notify();
}
}
} |
a41db979-1abc-4313-9293-1e0578a97c8a | 4 | public static void token_stemming(String[] tokens, String[] suffixes) {
for (String token : tokens) {
int longestMatchedSuffixLen = 0;
for (String suffix : suffixes) {
boolean matches = token.endsWith(suffix);
boolean longer = longestMatchedSuffixLen < suf... |
841bca9f-791f-42d6-8748-fe48e6a3aa1a | 8 | private BlockStatement compileFor() throws ParseException, IOException {
// (
getSymbol('(', "( is excepted after for");
// <identifier>
getNextToken(Tokenizer.IDENTIFIER, "identifier is excepted after (");
// <var-name>
Vector<Expression> expressions = new Vector<Expression>();
Vector<Integer> lengths ... |
1e32190e-2651-4b8f-a11a-3f507ed287ff | 9 | void dump(String indent) {
log.trace(indent + "***** CALL DUMP *****");
log.trace(indent + "TSCall: " + this);
log.trace(indent + "TSCall ID: " + this.callID);
log.trace(indent + "TSCall UCID: " + this.ucid);
log.trace(indent + "TSCall non-Call ID: " + this.nonCallID);
log.trace(indent + "TSCall state: " + ... |
5fea7bf7-03e6-4722-8889-ea324df30be5 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof NightArrivedMessage)) return false;
NightArrivedMessage that = (NightArrivedMessage) o;
if (!Arrays.equals(playersName, that.playersName)) return false;
return true;
} |
a45f3c03-1524-4b0a-a80a-39de81548349 | 7 | public int maxPoints(Point[] points) {
int big =0;
int flag =0;
if(points.length<2){
return points.length;
}
for(int i = 0; i < points.length ; i++)
for(int j=i+1; j <points.length; j++){
if((points[i].x != points[j].x) || (points[i].y != points[j]... |
4904b349-8c7f-4cfa-b57f-712f62e2ace5 | 1 | private void sendImageToGUI()
{
if (bulbPower < images.size())
{
appFrame.changeImage(bulbPower);
}
} |
54fca603-4cb1-42e4-afa9-1382df15b91c | 1 | public void switchArriereState(){
_arriere = !_arriere;
_statutTexture = 0;
if (_arriere) {
_texture = _liste_texture_back.get(0);
} else {
_texture = _liste_texture.get(0);
}
} |
270b67a5-dd34-4ed7-85e2-9e05ac36cc54 | 0 | public void setLineEnding(String lineEnding) {this.lineEnding = lineEnding;} |
c0601468-6510-487b-8020-6287bd77594a | 3 | public Garage() {
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("voitures.txt"));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try {
if (br.readLine() == null) {
System.out.println("Aucune... |
62d8c08e-499c-45db-9efc-6e5ba7cbdf52 | 8 | public PainelEsconde(Painel pn){
//tabuleiro.setLayout(null);
tabuleiro = pn;
//this.setBounds(10, 10, 500, 500);
//this.setBackground(null);
apagaBotao = new MouseListener() {
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
}
@Override... |
dcd51080-00c4-4bec-ba22-b8ae764cb2e3 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
305a73c0-f9eb-459f-8823-3dabf468a79c | 7 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
String operation = request.getParameter("operation");
Command com = null;
if(operation == null){
com = new ShowCommand();
} else if(operation.eq... |
437c8844-632a-4781-aa82-011cdc4ab274 | 1 | public ControleurApplication(BDApplication modeleApp, VueApplication vueApp) {
this.modeleApp = modeleApp;
this.vueApp = vueApp;
controleurListe = new ControleurListe(modeleApp.getListe(),
vueApp.getVueListe());
for (int i = 0; i < vueApp.getVueCommande().NBBOUTONS; i++) {
this.vueApp.getVueCommande().ge... |
6d89a0e1-2b3b-4fdc-86c8-60d6f3687ab5 | 8 | private void render() {
if (!initialized) {
if (this instanceof IPreloadModifier){
IPreloadModifier modifier = (IPreloadModifier) this;
modifier.renderPreLoadScreen();
} else {
fontRenderer.setRenderingSize(5);
fontRenderer.... |
785b7a3d-2722-4c9c-ac8f-71be81f4b32b | 8 | private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(EOFException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
case 99:
... |
d6587475-b101-47e6-bc0d-72e85ebbd776 | 0 | public Doctor(String name, String userName, String password, int room){
this.name=name;
this.userName=userName;
this.password=password;
this.room = room;
} |
cad6284f-24b9-4fdd-84c8-2b8d597ce150 | 3 | private void writeAchievements(OutputStream out, List<AchievementRecord> achievements) throws IOException {
writeInt(out, achievements.size());
for (AchievementRecord rec : achievements) {
writeString(out, rec.getAchievementId());
int diff = 0;
switch(rec.getDifficulty()) {
case NORMAL: diff = 1;... |
a7c6d07f-58df-4b89-b9ac-3109003c72e6 | 5 | @Test
public void testGenerateOnlyDistributionsEVRangeFromRestrictions() {
int maxEVs = 200;
int minEVs = 80;
when(restrictionsModel.getMaxEVs()).thenReturn(maxEVs);
when(restrictionsModel.getMinEVs()).thenReturn(minEVs);
Set<EVDistribution> initialCollection = evDistributionFactory.getInitialCollection(res... |
6ed052dc-4484-4ad3-b7ca-3436a1972760 | 3 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ArrayWorld other = (ArrayWorld) obj;
return Arrays.deepEquals(cells, other.cells);
} |
0c928a96-e6c8-4b7f-8875-32b497c4ed0e | 1 | @Override
public String[] getListOfMembers() {
List<Member> memberList = data.getListOfMembers();
String [] memberArray = new String[memberList.size()];
for(int i=0;i<memberList.size();i++){
memberArray[i]=memberList.get(i).getFirstname() + " " + memberList.get(i).getLastname();
}
return memb... |
620f209c-1807-41fb-a93a-82e1cb7fadb6 | 8 | @Override
public void dragOver(DropTargetDragEvent event) {
TreePanel panel = getPanel();
TreeContainerRow parentRow = null;
int insertIndex = -1;
if (acceptDrag(event)) {
Point pt = panel.toContentView(new Point(event.getLocation()));
TreeRoot root = panel.getRoot();
TreeRow overRow = panel.overRow(p... |
7c689f16-d285-4941-96b9-dfcb315bedd3 | 4 | protected boolean matchKind(Item item) {
if (this.type != item.type) return false ;
if (this.refers != null) {
if (item.refers == null) return false ;
if (! this.refers.equals(item.refers)) return false ;
}
return true ;
} |
93fc61cd-d55b-4df5-aa9a-ba1e4496a694 | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
boolean first = true, prevNoEmpty = true;
while ((line = in.readLine()) != null && line.length() != 0) {
if (!firs... |
2d0a2971-6045-4db3-8ddf-faadfd036dab | 2 | public static void makeFieldAccessible(final Field field) throws SecurityException {
if (!field.isAccessible()) {
if (System.getSecurityManager() == null) {
field.setAccessible(true);
} else {
AccessController.doPrivileged((PrivilegedAction<Void>) () -> {
field.setAccessible(true);
return null... |
37acf1b7-b3b3-417c-9bf7-242511fa0536 | 3 | private int find(int index){
int low = 0;
int high = fillLevel - 1;
while (low <= high) {
int mid = (low + high) >>> 1;
int midVal = index(mid);
if (midVal < index)
low = mid + 1;
else if (midVal > index)
high = mi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.