method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6309bc81-4a84-4ed0-8cfc-9866219a5385 | 4 | public synchronized void setStatus(String status, double progress)
{
if ((splash == null) || (!splash.isVisible())) return;
if ((progress < 0) || (progress > 1))
throw new IllegalArgumentException("Invalid progress " + progress);
graphics.setColor(progressColor);
int width = (int) (progress * progressArea.w... |
bb860fb4-8fdd-432d-b524-e347ca8a5151 | 3 | private static void compileLogCheck(int shader) {
String infoLog = GL20.glGetShaderInfoLog(shader, GL20.glGetShader(shader, GL20.GL_INFO_LOG_LENGTH));
if(GL20.glGetShader(shader, GL20.GL_COMPILE_STATUS) == GL11.GL_FALSE)
throw new RuntimeException("Failure in compiling the shader.\nError log:\n"+infoLog);
els... |
f78cda51-bdc6-4b7d-bd26-09f9b259160f | 1 | public String getUnprepared() {
if (this.sqlCache == null) {
this.sqlCache = builder.toString();
}
return sqlCache;
} |
4727eff7-6eaa-4284-8976-eb5c85209457 | 0 | public static void main(String[] args) throws ParseException {
//
new SqlDates().insertDates();
} |
23bc1efa-8b57-4e86-a859-1edcbf33741e | 0 | private void drawHealthBar(Graphics g){
g.setColor(new Color(9, 21, 178));
g.fillPolygon(
new int[]{50, 300, 320, 70},
new int[]{game.getWindowSize().height-100, game.getWindowSize().height-100, game.getWindowSize().height-70, game.getWindowSize().height-70},
4
);
g.setColor(new Color(145, 44, 0))... |
da4ea3b7-3ad4-45f1-a3ed-705575b22ab6 | 2 | public static int nextConnectionId(int connectionId) {
if(connectionId == Packet.ANONYMOUS_CONNECTION_ID || connectionId == Packet.MAXIMUM_CONNECTION_ID)
return Packet.MINIMUM_CONNECTION_ID;
return connectionId + 1;
} |
79aa353e-2722-4e7f-a399-d669f5f07cb2 | 1 | private int getCount(T item) {
if (histogram.containsKey(item))
return histogram.get(item);
return 0;
} |
12b17ce2-d75f-44c3-8bf7-1d6f09e9bf21 | 0 | public V getValue() {
return value;
} |
85aa0971-3595-45f0-91b8-4b2117fa6dfd | 3 | public int [] getLanguages ()
throws IOException
{
synchronized (lock) {
if (!checkedStrings)
languages = ControlMessage.getLanguages (this);
checkedStrings = true; //if don't set this can get repetitive lookup failures? -- Wayne Westerman
}
if (languages == null)
return null;
int ... |
64a4704a-220e-41ad-be1f-36c50b044f01 | 4 | public String toString()
{
//System.out.println(kind + "(lineNum:" + this.lineNum +"," + "charPos:" + this.charPos + ")");
if (this.kind == Kind.ERROR){
return (kind + " (Unexpected character: " + (char)value +")"+ "(lineNum:" + lineNum +"," + "charPos:" + charPos + ")");
}
else if(this.kind == Kind.IDENTIF... |
4962f353-57ba-4849-88af-fbf12b545d87 | 5 | private void applyLayout() {
GroupLayout gl = new GroupLayout(getContentPane());
gl.setAutoCreateContainerGaps(true);
gl.setAutoCreateGaps(true);
setLayout(gl);
JLabel lFind = new JLabel(Runner.editorInterface.getString("FindDialog.FIND_LABEL")); //$NON-NLS-1$
tFind = new JComboBox<String>();
... |
9713a00a-e63d-415d-9cc2-e33f9982e427 | 4 | public MenuPrincipal() throws FileNotFoundException, IOException, ClassNotFoundException, InterruptedException {
initComponents();
Reloj tim = new Reloj();
tim.setVisible(true);
this.jTextField3.setBackground(Color.DARK_GRAY);
Date date = new Date();
S... |
74ba508e-7d3d-433f-babb-e1e448a8b419 | 9 | public void printWithOrder(ArrayList<Row> rows, ArrayList<Field> fields,
boolean headerLine) {
System.out.println("==============================================");
if (rows.size() == 0) {
System.out.println("No Result");
}
Collections.sort(fields);
int lineSize = 0;
Iterator<Field> itField = fields... |
d0fd41f4-b053-4c80-b3f3-6a02333cf0fa | 0 | @Override
public void componentHidden(ComponentEvent e) {} |
5956cb74-57ef-4f80-bb64-4736a20facee | 2 | private void preOrderPositions(Position<T> p, ArrayList<Position<T>> pal)
throws InvalidPositionException, BoundaryViolationException {
pal.add(p);
if (hasLeft(p))
preOrderPositions(left(p), pal);
if (hasRight(p))
preOrderPositions(right(p), pal);
} |
744f0f8e-1e69-4285-9216-fed2de65adc9 | 4 | public void register(int clientId) throws ClientAlreadyExistsException, ClientRegisterFailureException {
_clientId = clientId;
try {
_out.writeInt(8); //Size
_out.writeInt(Response.MSG_CLIENT_REGISTER);
_out.writeInt(_clientId);
_out.flush();
... |
dbf0f239-730e-4ed7-ac79-c863397c9757 | 3 | @Override
public void run() {
Thread.currentThread().setName("Multicast Monitor");
byte[] buffer = new byte[1024];
byte[] temp;
DatagramPacket dpack = new DatagramPacket(buffer, buffer.length);
SmallPacket dp;
while (true) {
try {
mSock.receive(dpack);
temp = new byte[dpack.getLength()];
... |
4dbe4720-7655-462c-9f83-06836d73c9bb | 1 | public static <E> void _findArray(String tableName, long id, Collection<E> rtn) throws SQLException {
ResultSet resultSet =
Data._find(tableName, "key", String
.valueOf(id));
for (int i = 0; resultSet.next(); i++)
{
rtn.add((E)resultSet.getObject(2));
}
} |
31b4f4ff-7b0e-4299-b174-ef71fc7001a3 | 3 | @Override
public double checkConstraint() {
int totalAvatars = 0;
for(String avatar:gameAnalyzer.getAvatarSprites()){
if(numOfObjects.containsKey(avatar)){
totalAvatars += numOfObjects.get(avatar);
}
}
return totalAvatars == 1? 1:0;
} |
9e35df99-7f67-4a82-8e4d-0e7975f22064 | 2 | @Override
public void playSound(int ID, boolean loop)
{
for(int i = 0; i < sounds.size(); i++)
{
if(ID == sounds.get(i).getID())
{
sounds.get(i).playAudio(loop);
}
}
} |
a4e68546-cc83-4c45-8f41-c548e2b3bd29 | 0 | public ArrayList<Event> getEvents ()
{
return events;
} |
d8898d18-e117-4c67-bf7a-738637b54be2 | 4 | private List<File> listFilesForFolder(final File folder)
{
List<File> ret = new ArrayList<File>();
if (folder.listFiles() == null)
{
if (processTrayIcon != null)
processTrayIcon.displayMessage("Connection Error Message",
"Could not find folder " + folder, TrayIcon.MessageType.ERROR);
return ret;
... |
c612b45a-6485-4766-84b0-a3710cf1265a | 3 | private boolean isFileValid(File file, String methodName) {
if (file == null) {
System.out.println(name_ + "." + methodName
+ ": Warning - the given file is null.");
return false;
}
String fileName = file.getName();
if (fileName == null || fi... |
3267adb2-6f7b-49ee-918e-cc933233e64f | 7 | public int look(int bits){
int ret;
int m=mask[bits];
bits+=endbit;
//System.err.println("look ptr:"+ptr+", bits="+bits+", endbit="+endbit+", storage="+storage);
if(endbyte+4>=storage){
if(endbyte+(bits-1)/8>=storage)return(-1);
}
ret=((buffer[ptr])&0xff)>>>endbit;
// ret=((byte)(bu... |
188b43df-3e20-4234-ade5-0d15f21131dc | 7 | public boolean readDictionary()
{
if (_dictionaryPath == "")
{
if (!setPath())
{
return false;
}
}
BufferedReader in;
try
{
// A File must be opened in order to be able to access Distributed Cache.
in = new BufferedReader(new InputStreamReader(new FileInputStream(new File(_dictionary... |
77cc670e-6ba0-4a6b-8ba2-c78c6fac4a1a | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));int caso=1;
for(StringTokenizer st;(st=new StringTokenizer(in.readLine()))!=null;){
int N=parseInt(st.nextToken()),M=parseInt(st.nextToken());
if(N==0&&M==0)break;
lAdy=new TreeSe... |
69f300bc-5d83-4e32-8e73-6cc33a41c494 | 2 | public void printTabla(){
int x=0;
Node tmp=entradas.getHead();
while(x<entradas.getLength()){
List<Integer> list= (List<Integer>) tmp.getData();
list.print();
tmp=tmp.getNext();
x++;
}
int y=0;
Node tmp1=salidas.getHead();... |
644ee923-ae3b-43a1-be15-8ad18e438604 | 9 | public void fillDeck(){
/* Randomly assign the terrains. Set aside
* 4 sea terrains and stick them in the middle of
* the deck randomly.
*/
Random rand = new Random();
for (int i=0; i<(size-4); i++){
int r = rand.nextInt(7);
switch(r){
case 0: { td.add(new Terrain("Jungle", "... |
75013b30-ed69-414c-99e5-6b78e05154c2 | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
9c1166e3-6d63-4728-9b65-74ddb1b37ca7 | 8 | public JsonObject getActivityStatus( JsonObject json ) {
// Get and validate parameters
JsonValue activityJsonValue = json.get("activity");
if ( activityJsonValue == null ) return new JsonObject().add("error", "Parameter activity is null");
if ( !activityJsonValue.isObject() ) return new JsonObject().add("er... |
5a464374-5ad9-4364-a667-ff68bbd8eee0 | 1 | private synchronized void handle()
{
try
{
System.out.println("Server Berjalan ");
Registry registry = LocateRegistry.createRegistry(Constant.PORT_APPLICATION);
registry.rebind(Constant.PHP_REGISTRY_OBJECT, new RMICore());
}
catch(RemoteException e... |
8e560a93-2c68-449b-b635-a546390ab8bd | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((carRenter == null) ? 0 : carRenter.hashCode());
result = prime * result + ((carType == null) ? 0 : carType.hashCode());
result = prime * result + ((endDate == null) ? 0 : endDate.hashCode());
result = pr... |
2d654d28-9ee3-41dd-94a1-2b1896d93193 | 5 | @Deprecated
public static String parseStaffMessage(CommandSender sender, String message)
{
String format = StaffChat.getStaffChat().getConfiguration().getFormat();
format = StringUtilities.replaceCodes(format);
if(sender.hasPermission(Permissions.COLOR))
{
message = StringUtilities.replaceCodes(m... |
2710b807-1a6c-4d5a-bc64-838196c12e9d | 4 | private void drawMesh()
{
lastTexture.bind();
if(vbo == 0 || ibo == 0)
{
vbo = glGenBuffers();
ibo = glGenBuffers();
}
if(iidx == 0 && vidx == 0)
return;
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER, Vertex.createBuffer(vertices), GL_DYNAMIC_DRAW);
glBindBuffer(... |
e10e5f5f-32d3-4529-a4c2-f478f0960573 | 8 | @Override
public Auction[] search(String criteria) {
Predicate<Auction> cp = null;
ArrayList<Auction> theSearch = new ArrayList<Auction>();
Stack<Predicate<Auction>> predicateStack = new Stack<Predicate<Auction>>();
Stack<String> operatorStack = new Stack<String>();
Predicate<Auction> firstSearchString... |
fd957a32-6379-44ff-9608-0a0740e61fe8 | 8 | public Object execute(String methodName, Vector params) throws Exception
{
Method method = null;
try
{
List<Method> methods = Arrays.asList(targetClass.getMethods());
for (Method m : methods) {
if (m.getName().equals(methodName)){
method = m;
break;
}... |
74d1e43c-c566-4ffd-9bd6-920b229b162c | 1 | public double[] computeMagnitude(double[] dataReal) {
double[] complex = new FFTReal().computeFFTReal(dataReal);
int fftLength = complex.length / 2;
double[] mag = new double[fftLength];
for (int i = 0; i < fftLength; i++) {
mag[i] = Math.sqrt(complex[2 * i] * complex[2 * i... |
f1586902-7c71-4cbe-aed2-68af4a17acdc | 2 | public boolean isKeyInput() {
return type == KEY_PRESSED || type == KEY_TYPED || type == KEY_RELEASED;
} |
ea5af7d1-56a4-415e-adcc-4351a1481fad | 3 | @Override
public void update() {
if(!isAlive || ObjectAction.getSnake() == null) {
return;
}
// the snake movement method
Movement.maintainDirection(this);
// basic collision detection
if(Collision.checkWallCollision(this)){
Collision.... |
f6419af9-2bc4-48d6-b427-d97bbea5cce1 | 7 | private void checkExpiryTime()
{
long currentTime = super.getCurrentTime(); // get current time
ARObject obj = null;
try
{
long endTime = 0;
// a loop that checks a reservation has been committed before the
// expiry time or not
for... |
75ce96a0-0088-494d-97f6-7f9752b6086c | 0 | public Dimension getDimension(){
return current;
} |
c93e9151-8606-4cab-a4ca-c2e2dc9cd335 | 5 | private static Distance<Contact> getDistance() {
Distance<Contact> bm_distance = new Distance<Contact>(){
@Override
public double distance(Contact c0, Contact c1) {
Set<String> langs0 = getLanguages(c0);
Set<String> langs1 = getLanguages(c1);
if(langs0.isEmpty() || langs1.isEmpty()) return... |
f211c8b3-dc1d-427d-8091-3281276221ba | 0 | public char[] getDelimiters() {
return this.delimiters;
} |
2c5e8a58-e8b5-405b-b76c-3fcdc0ea1179 | 5 | private final void method1502(int i, byte i_20_,
Class258_Sub2 class258_sub2, int i_21_,
int i_22_) {
anInt4876++;
if ((anInt4873 ^ 0xffffffff) == 0)
throw new RuntimeException();
int i_23_ = 1 << i_21_;
if (i_20_ > -16)
aBoolean4888 = false;
if ((anInt4884 & (i_23_ ^ 0xffffffff) ^ 0xffffffff... |
663b7e59-5cce-4f6d-9e74-d073b3e85323 | 8 | @Test
public void testPlayersQueriedInOrder() { // This tests that the players are surveyed in order to see if they hold the cards.
ArrayList<Player> playersTest = board.getPlayers();
ArrayList<Card> hold3 = playersTest.get(3).getCards();
ArrayList<Card> newHand = new ArrayList<Card>();
newHand.add(new Card(ty... |
a12b94e8-0422-44c1-9f4e-5fc4dc60fc24 | 4 | private void calculateAllChangesForInterval(float startDate,
float[] startPrices, float[] endPrices) {
float[] changes = new float[dbSet.size()];
int errors = 0;
for (int i = 0; i < dbSet.size(); i++) {
if (endPrices[i] != endPrices[i]
|| startPrices[i] != startPrices[i])
errors++;
// can be NaN... |
4cac9e5d-3628-4372-a988-3bb13a910411 | 3 | private void addNode(Element rootElement, TreeItem treeItem, Document xml) {
Element childElement = xml.createElement(VCNConstants.NODE);
childElement.setAttribute(VCNConstants.NAME, treeItem.getText());
childElement.setAttribute(VCNConstants.EXPANDED, treeItem.getExpanded() + "");
Element textElement = xml.cr... |
e1f73802-f457-4701-b9d2-9b03b04834e3 | 9 | public void workspaceEventOccurred(WorkspaceEvent e) {
// TODO Auto-generated method stub
if (e.getEventType() == WorkspaceEvent.BLOCKS_CONNECTED) {
BlockLink link = e.getSourceLink();
if (link.getLastBlockID() != null && link.getLastBlockID() != Block.NULL
&&... |
b985a59e-698b-4b38-830a-77cc53fec65e | 3 | private double simulate(StateObservation stateObs, StateHeuristic heuristic, int[] policy) throws TimeoutException {
//System.out.println("depth" + depth);
long remaining = timer.remainingTimeMillis();
if (remaining < BREAK_MS) {
//System.out.println(remaining);
throw n... |
06f43990-1224-43cf-bfd2-99f0b1f7d039 | 2 | public BigWigSection(byte[] sectionBuffer, HashMap<Integer, String> chromosomeMap,
boolean isLowToHigh, RPTreeLeafNodeItem leafHitItem){
this.chromosomeMap = chromosomeMap;
this.isLowToHigh = isLowToHigh;
this.leafHitItem = leafHitItem;
// wrap the Wig section... |
c30753fd-4bd0-4213-8a2e-14afe0a0c7ae | 1 | protected void calculateMedian()
{
double[] b = new double[data.length];
System.arraycopy (data, 0, b, 0, b.length);
Arrays.sort (b);
if (data.length % 2 == 0) {
median = (b[(b.length / 2) - 1] + b[b.length / 2]) / 2.0;
} else {
median = b[b.length / 2];
}
} |
fa2dcd9d-df1e-438b-b8c7-d0e0f0610308 | 2 | public static int readInt() {
String line = null;
int value = 0;
try {
BufferedReader is = new BufferedReader(new InputStreamReader(
System.in));
line = is.readLine();
value = Integer.parseInt(line);
} catch (NumberFormatException e... |
7611d078-79c5-45a9-a32f-3a7613caa634 | 4 | public synchronized void setProgress(double progress)
{
if ((splash == null) || (!splash.isVisible())) return;
if ((progress < 0) || (progress > 1))
throw new IllegalArgumentException("Invalid progress " + progress);
graphics.setColor(progressColor);
int width = (int) (progress * progressArea.width);
grap... |
6c3c6b0e-c573-4677-a72b-c911af7d1628 | 3 | public static ArrayList<bConsulta> getListaProdDataDef(String dt1) throws SQLException, ClassNotFoundException {
ArrayList<bConsulta> sts = new ArrayList<bConsulta>();
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conex... |
18f1660d-f3a4-4496-af81-36bddd2c45ac | 4 | public void setStandardButtonPosition(Position position) {
if (position == null) {
this.buttonStd_Position = UIPositionInits.STD_BTN.getPosition();
} else {
if (!position.equals(Position.LEFT) && !position.equals(Position.RIGHT) && !position.equals(Position.CENTER)) {
... |
57358827-5f28-478e-8303-837f732f32d4 | 3 | public boolean batchAddCommand(String chain, Map<String, Class> stringClassMap) {
List<String> chainList = Arrays.asList(StringUtils.split(chain, "."));
Module moduleByChain = this.getModuleByChain(chainList);
if (null == moduleByChain) {
moduleByChain = this.createModuleChain(chainL... |
2f17c1c3-297d-4454-90bb-3481023d6a8f | 4 | private int readCharConst(Token token) {
int c;
int value = 0;
while ((c = getc()) != '\'')
if (c == '\\')
value = readEscapeChar();
else if (c < 0x20) {
if (c == '\n')
++lineNumber;
return BadToken;
... |
011d5cf0-1fb3-454a-93c8-61f01ce92597 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final Address other = (Address) obj;
if (macAddress == null) {
if (other.... |
6f4a034e-01fd-423c-8088-25be3af4352f | 9 | public void changeBackgroundImage(String str) {
if (isRemote())
throw new RuntimeException("Background image of a remote page cannot be changed.");
if (str == null) {
if (getBackgroundImage() != null)
setBackgroundImage(null);
} else {
if (str.equals("null") || str.trim().length() == 0) {
if (get... |
ac990fff-59ec-4ebe-94ac-5cdbe320d1a0 | 0 | public static int zufallszahl(int untereGrenze, int obereGrenze) {
return Math.abs(RANDOM.nextInt() % (obereGrenze + 1 - untereGrenze)) + untereGrenze;
} |
0281e9ac-da0f-4041-8535-41fd8747df2b | 8 | public void solve(int testNumber, Scanner in, PrintWriter out) {
while(in.hasNextLine()){
int initPos = in.nextInt();
int c1 = in.nextInt();
int c2 = in.nextInt();
int c3 = in.nextInt();
if(initPos == 0 && c1 == 0 && c2 == 0 && c3 == 0) break;
long answer = 1080; /... |
07798274-b462-4e7c-9d15-4d5b6435a200 | 8 | public static int[] getSecondPassChords(final Phrase phrase,
final double beatLength,
final int tonic,
final int[] scale) {
Possible[] chords = getChords(phrase, beatLength, tonic,... |
bc3ec364-7e1a-4a6a-920b-9b9f1d5f1c61 | 9 | public void initAsteroids(){
asteroids = new ArrayList<Asteroid>();
for (int i = 0; i < level + 2; i++){
int randX, randY;
double distTo1 = 0, distTo2 = 0;
if (player2 != null){
do {
randX = (int)(Math.random()*screenWidth);
randY = (int)(Math.random()*screenHeight);
distTo1 = Math.sqrt(... |
b901173b-3769-480d-82ea-3e79f43a6b7b | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
da87b037-90f3-4fc7-ae5a-3864e3b54b38 | 0 | PersistentCanvas(DrawableItemController dicon) {
items = new ArrayList<>();
// gest = new Gesture();
dic = dicon;
} |
5f00c54d-87dd-4261-acbb-2ddc8987ac28 | 3 | public int[] getNextAvailablePosition(Board board){
boardArray=getBoardState(board);
for(int i=0;i<board.getBoardSize();i++){
for(int j=0;j<board.getBoardSize();j++) {
if(boardArray[i][j]=="-")
return new int[]{i,j};
}
}
return ... |
28d7d11a-c55d-41e7-ba9d-7e4119f31e36 | 1 | public void dropInfo(int howMuch) {
if ((howMuch & KNOWNATTRIBS) != 0)
constant = null;
super.dropInfo(howMuch);
} |
a69c29d0-465f-4cdc-8317-3caf1e71bc12 | 2 | public static boolean anyKeyPress() {
for (int i = 0; i < NUM_KEYS; i++) {
if (keyState[i]) {
return true;
}
}
return false;
} |
34ff898b-26cf-4ea2-9dea-b32aad46bc6c | 0 | @Override
public String toString() {
return string;
} |
b2f53c47-56bb-4ed6-a10c-39e26e7eef63 | 0 | @Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
int w = getWidth();
int h = getHeight();
g2d.setColor(Color.black);
g2d.fillRect(0, 0, w, h);
su... |
299e2ea2-a6e5-4917-9a8a-08e1a210c64c | 7 | @Override
public String getColumnName(int column) {
switch (column) {
case 0:
return "Id";
case 1:
return "X";
case 2:
return "Y";
case 3:
return "Discriminant";
case 4:
... |
59f9de8e-b856-4ac7-9423-54f061b4cbe6 | 2 | public void keyPressed(KeyEvent e){
if (e.getKeyCode() == KeyEvent.VK_LEFT){
leftPressed = true;
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT){
rightPressed = true;
}
} |
22a7c946-6779-48c1-9531-c04bb922ce9e | 8 | public String nextToken() {
if(!hasMoreTokens()) {
throw new RuntimeException("No Tokens left!");
}
int grade=0;
for(int i=0;i<s.length();i++) {
if(s.charAt(i)==')') {
grade--;
}
else if(s.charAt(i)=='(') {
g... |
b02fbf06-11b5-4acd-9a86-a2ef0717b7cc | 4 | @Override
protected Player getPlayer(Grid grid, int playerNr, Position pos) {
if (grid == null || pos == null || playerNr <= 0 || playerNr > getMaxNumberOfPlayers())
throw new IllegalArgumentException("The given arguments are invalid!");
return new PlayerCTF(grid, playerNr, pos);
} |
3af50383-a49d-470e-8bcd-d8b1f81eb865 | 2 | public PositionRange (long lower, long upper) {
if (lower < 0 || upper < lower) {
throw new IllegalArgumentException();
}
this.lower = lower;
this.upper = upper;
} |
90706606-6e0f-478c-8371-c94a4ce57ffb | 4 | private boolean isStraight(HantoCell from, HantoCell to){
boolean isStraight = false;
// Check North/South Move
if (from.getX() == to.getX()){
isStraight = isVerticallyOccupied(from, to);
}
// Check NE/SW Move
else if (from.getY() == to.getY()){
isStraight = isHorizontallyOccupied(from, to);
... |
de4c8950-dcb5-4898-8257-a7635c2b1e6b | 4 | @Override
protected void doUpdate(double dt) {
WormSprite sprite = getScreen().getWormSprite(getWorm());
try {
if (getElapsedTime() >= jumpDuration) {
if (!hasJumped) {
hasJumped = true;
getFacade().jump(getWorm(), GUIConstants.JUMP_TIME_STEP);
if (getFacade().isAlive(getWorm())) {
doub... |
df8da1c8-3ecc-4de8-995d-70a4809cec81 | 4 | @Override
public void apply(Graphics2D g)
{
g.setColor(new Color(color));
g.setStroke(new BasicStroke(stroke, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
switch (type)
{
case OVAL:
if (fill)
{
g.fillOval(x, y, width, height);
}
else
{
g.drawOval(x, y, width, height);
}
case... |
5ab9cc38-06b6-48d7-a559-ce58189e9173 | 7 | public void loadingMap(){
switch(loadingCount){
case 1:
updateMapProgress(0.10f, "Initializing Map");
initStates();
updateMapProgress(0.10f, "Create Ship");
break;
case 2:
// create ship
ship = new Ship(stateManager);
Vector3f loc = mapObjectExtractor.warp.getNode().getLocalTranslation();
s... |
66ed8508-2d62-4941-8603-29a3a05b9834 | 7 | @Override
public void create(DataObject obj) throws SQLException {
if(!(obj instanceof ProductGroupDO))
throw new IllegalArgumentException("Tried to save a non StorageUnit in " +
"DBStorageUnitDAO");
PreparedStatement stmt = null;
Statement keyStmt = null;
ResultSet keyRS = null;
SQLException excepti... |
a3b30bee-8c9f-44b6-be77-48397c255b08 | 0 | protected TableModel createModel(Transition transition) {
final PDATransition t = (PDATransition) transition;
return new AbstractTableModel() {
public Object getValueAt(int row, int column) {
return s[column];
}
public void setValueAt(Object o, int r, int c) {
s[c] = (String) o;
}
public bo... |
af3f670d-8ed4-403f-8c70-f3dcaf7b84db | 7 | @Override
public boolean equals(Object obj) {
boolean result = false;
Fisico myObj = (Fisico) obj;
if(this == obj) result= true;
if(obj == null || (this.getClass() != obj.getClass()))
result = false;
if((this.raza == myObj.raza) && (this.contextura == myObj.c... |
d2c3b387-b787-44f0-a33c-f26be7fa7d14 | 7 | public StringBuffer printExpression(int indent, StringBuffer output){
if (receiver!=null && !receiver.isImplicitThis())
{
receiver.printExpression(0, output);
if (selector!=null)
output.append('.');
}
if (selector!=null)
output.append(selector);
output.append('(') ;
if (arguments != null) {
for (int i... |
5db95187-76f0-43b5-8798-dff34a09b715 | 0 | public void setName(String name) {
this.name = name;
} |
1800e1d7-6943-46aa-ada9-9a61e2c21ef6 | 0 | public void mouseExited(MouseEvent e) {
} |
6c9b0254-7134-465d-b869-8a92a61ab83c | 9 | static void drawplayfield(int n, osd_bitmap bitmap)
{
if (taitosj_video_enable!=0 & playfield_enable_mask[n]!=0)
{
int i,scrollx;
int[] scrolly=new int[32];
scrollx = taitosj_scroll.read(2*n);
if (flipscreen[0]!=0)
scrollx = (scrollx & 0xf8) + ((scrollx + fudge1[n]) &... |
9dc03f49-6e52-4b37-ac41-d615deb03ac5 | 7 | static int count( ){
if( punches[0] == 1 || punches[1] == 1 || punches[2] == 1 || punches[3] == 1 )
return d;
else {
int cont = 0;
for ( int i = 0; i < punches.length; i++ ) {
for ( int j = punches[i]; j < hit.length; j+=punches[i] ) {
if( !hit[j] ){
cont++;
hit[j] = true;
}
}... |
dc079024-1b54-4726-b651-92d8fb6c9adf | 2 | public static int getKeyByValue(Map<Integer, String> map, String value) {
for (Entry<Integer, String> entry : map.entrySet()) {
if (value.equals(entry.getValue())) {
return entry.getKey();
}
}
return -1;
} |
cf2d5d11-13c3-477d-a558-d84318ca0675 | 1 | public int getCount(ArrayList<FilterBean> hmFilter) throws Exception {
int pages;
try {
oMysql.conexion(enumTipoConexion);
pages = oMysql.getCount("profesor", hmFilter);
oMysql.desconexion();
return pages;
} catch (Exception e) {
throw ... |
22f81f10-6550-4ec1-9382-2e0136630a66 | 9 | public SortResult sort(File file, File temp, int threads, boolean verbose) throws InterruptedException, IOException {
BufferedRandomAccessFile tempRaf = null;
BufferedRandomAccessFile fileRaf = null;
try {
if ((temp = createIfAbsent(temp, verbose)) == null) {
retur... |
9d2d8ac9-bd78-4350-ae57-a4c0af39a975 | 6 | @SuppressWarnings("deprecation")
public void ucitajPodatke()
{
ocistiKontrole();
if (listG.getModel().getSize() == 0)
return;
Klase.Gost g = (Klase.Gost) listG.getSelectedValue();
if (g == null)
return;
if (isStraniGost(g)) {
textField_3.setText("Strani");
textField_14.setEditable(true);
t... |
50b069cd-c8f4-4c0f-ba83-261115fe4bbf | 5 | @Override
public void run() {
for (ChatOption option : ctx.chat.select().text("Tongs").first()) {
if (option.select(Random.nextBoolean())) {
Condition.wait(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return !ctx.backpack.select().id(MakeSword.TONGS).isEmpty();
... |
3f934ed9-d72a-44fe-bf76-44e5646522a1 | 7 | private void paintWin(Graphics g) {
boolean test = false;
if (test || m_test) {
System.out.println("GameBoardGraphics :: paintWin() BEGIN");
}
Iterator<Coordinate> iterator = m_win.iterator();
while (iterator.hasNext()) {
m_next = iterator.next();
if (PLAYER1_COLOUR.equals(Color.BLACK)
|| PLAYER... |
9a3530f9-bc6e-4c86-916d-42f73f114473 | 5 | public void addRandomBalls(int count) {
int rndY, rndX;
for (int i = 0; i < count; i++) {
if (_freeCells == 0) {
_linesGame.gameOver();
break;
}
for(;;) {
rndX = _random.nextInt(_nX);
rndY = _random.nextInt(_nY);
if (_state[rndY][rndX] == null) {
_state[rndY][rndX] = getNextBall();... |
0c07ea62-e958-4d79-a638-d1501569619a | 0 | @Override
public void goOffline() {
chatCore.leaveChat();
chatCore.stopServer();
participantList.setAllParticipantsOffline();
} |
315fa625-bd4a-40b6-980c-5c456bf3fa98 | 4 | @Override
public void handleMessages(Inbox inbox) {
if(!isSending) { // don't even look at incoming messages
return;
}
if(inbox.hasNext()) {
Message msg = inbox.next();
if(msg instanceof S1Message) {
S1Message m = (S1Message) msg;
if(next != null) {
m.data += increment;
DelayTimer dt =... |
37c7427d-9fd0-4416-8475-d9f7fedacf69 | 9 | public Object[] displayDataWords(boolean hex) {
int bits = (int)(Math.ceil(Helpers.log(size, (hex)? 16 : 10)));
String[] headers = {"Address", "Word"};
int length = 0;
for (int a : memory.keySet())
if (a % 2 == 0 && getWord(a) != 0)
length++;
String[][] data = new String[length][2];
int i = 0;... |
1979da02-3d53-43dd-90f4-0814f2ac2f06 | 8 | private void addMultiCallsOption(String options, Map<Date, Double> fees, boolean biz) {
double optionalFee = 0;
if (options == null || options.length() == 0) {
return;
}
String[] optionArray = options.split(";");
// multi-calls option
final Properties prop = loadProperties();
for (int i = 0; i < optio... |
91ea4e1e-fb23-4f96-b4ea-cbdd10d6133e | 7 | String pickInitialState(StateTree pathsToExplore) throws IOException {
execCommand("bmc_pick_state -v -i");
try {
Thread.sleep(80);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String fileContents = IOUtils.readFileAsString(outFile);
List<eu.fbk... |
9b945a43-2a07-4073-91f6-d4a7adf70794 | 7 | public void drawInternal(UGraphic ug) {
for (Map.Entry<IEntity, Cluster> ent : clusters.entrySet()) {
final Frame frame = frames.get(ent.getKey());
final Rectangle2D rect = PositionableUtils.convert(ent.getValue());
final double oldX = ug.getTranslateX();
final double oldY = ug.getTranslateY();
ug.tra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.