method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2540d819-307b-4321-be43-c88046ca9905 | 9 | private void processLine(String line, int lineNumber) {
if (line.startsWith("//") || line.trim().length() == 0) return;
DeconstructedStringScroller sd = new DeconstructedStringScroller(line, " ");
if (type == null) {
if (sd.next().toLowerCase().equals("class")) try {
String className = sd.next();
type ... |
6be74c97-b437-4408-8df6-9af4d4295657 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Truck)) {
return false;
}
Truck other = (Truck) object;
if ((this.id == null && other.id != null) || (this.id !... |
ba9eb422-b279-43de-b05e-7b98acdf248d | 0 | public void setId(Integer id) {
this.id = id;
} |
7b2636ba-8ce3-4def-b2c8-a9120cd16e7c | 9 | public void stealDeadEquipment(Player pgive, Player pget){
String head = pgive.playerTag + "'s inventory";
String textBlock = "Enter a number to take an item from " + pgive.playerTag + " : ";
ArrayList<String> strList = new ArrayList<String>();
ArrayList<Card> eqInv = new ArrayList<Card>();
for(Card card: pgi... |
f173b4e6-1cdf-47b2-99f5-a13295c6b44e | 5 | private Boolean checkOfFieldsOk() {
if ("".equals(txtDatabaseSettingName.getText())) {
txtDatabaseSettingName.setForeground(Color.red);
return false;
} else {
txtDatabaseSettingName.setBackground(Color.white);
}
if ("".equals(txtDatabaseAddres... |
ef463b02-3173-4f12-be4d-76ac45ec311b | 5 | private int parseLine(String line)
{
//preprocessing: remove extra whitespace, comments, lowercase
int commentPos = line.indexOf('#');
if (commentPos >= 0)
line = line.substring(0, commentPos);
line = line.trim().toUpperCase();
int i = 0; // Current position in t... |
77bf119c-80f3-40fc-9d2f-5890494a35c5 | 5 | public void bulkPut1( ByteChunk[] keys, ByteChunk[] values, int offset, int count ) {
long[] indexPos = new long[count];
for( int i=0; i<count; ++i ) {
indexPos[i] = indexPos(keys[i]);
}
FileLock fl = null;
synchronized( this ) {
try {
try {
if( fileChannel != null ) fl = fileChannel.lock(0... |
c9208c13-93a8-4125-8934-df9ffccc63e2 | 8 | private void optimiseSelectorsAndHuffmanTables (final boolean storeSelectors) {
final char[] mtfBlock = this.mtfBlock;
final byte[] selectors = this.selectors;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mtfLength = this.mtfLength;
final int mtfAlphabetSize = this.mtfAlphabetSize;
... |
1882c74d-747b-41e6-ab2b-50889b2dde28 | 5 | public boolean isNeighbour(GraphPoint p1, GraphPoint p2)
{
if (p1 == p2)
return false;
for (Point point : points)
{
if (point != p1 && point != p2 &&
p1.euclideanDistance2(p2) >
Math.max(p1.euclideanDistance2(point), p2.euclideanDistance2(point)))
{
return false;
}
}
return true;... |
a4312e0f-a82c-4561-9793-ede22d351556 | 6 | public static void act(Unit facility) {
if (facility == null) {
return;
}
int[] buildingQueueDetails = Constructing.shouldBuildAnyBuilding();
int freeMinerals = xvr.getMinerals();
int freeGas = xvr.getGas();
if (buildingQueueDetails != null) {
freeMinerals -= buildingQueueDetails[0];
freeGas -= bu... |
fd5a7a5a-d49d-4029-8c70-9ac10bfe0ed7 | 0 | public void setPassengers(List<Participant> passengers) {
this.passengers = passengers;
} |
d1d62c08-0b05-46e9-9226-3505882b9907 | 7 | @Override
public void collision(Engine engine, Entity v,boolean b) {
if(type==6)
{
boolean entitythere = false;
for(Entity q:engine.getWorld().getEntityList()){
if(entitythere)
continue;
if(q != null && (q.doesDamage()&&q.canDie()))
entitythere = true;
}
... |
8c180689-b56f-4a55-88fb-80a4219efbaf | 3 | public double readDouble(String pSection, String pKey, double pDefault)
{
//if the ini file was never loaded from memory, return the default
if (buffer == null) {return pDefault;}
Parameters params = new Parameters();
//get the value associated with pSection and PKey
String valueText = getValue(p... |
38cf944d-16a3-4715-b3cc-c36de72d80b8 | 1 | public void ancestorResized(HierarchyEvent e) {
if (GamePanel.getThis() != null) {
GamePanel.getThis().resizePanel();
}
} |
cc66ca5a-09c7-4932-88ba-2422dd941e43 | 5 | public void insert(E e)
{
int newPlace = heapSize;
while (newPlace > 0 &&
comparator.compare(e, array[getParent(newPlace)]) < 0)
{
array[newPlace] = array[getParent(newPlace)];
if (indexes != null)
indexes.put((E)array[newPlace], newPla... |
bd0ec2ef-7904-4dae-b022-5dc3f63c6cc4 | 8 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
int N = sc.nextInt();
if (N == 0) {
break;
}
Queue<Integer> q = new ArrayDeque<Integer>();
for (int i = 1; i <= N; i++) {
... |
c5f11666-0177-4f06-bd6c-50a3c978610f | 7 | public void write(int bits, int width) throws IOException {
if (bits == 0 && width == 0) {
return;
}
if (width <= 0 || width > 32) {
throw new IOException("Bad write width.");
}
while (width > 0) {
int actual = width;
if (actual > t... |
e1dddb27-8295-4cb0-8ef1-05d3a1711909 | 5 | public String getCellSymbol() {
if (rock) {
return "#";
} else if (ant != null) {
return "a";
} else if (food != 0) {
return food + "";
} else {
switch (anthill) {
case "red":
return "+";
... |
e7443692-8d7d-487d-a370-e453dc5d4fa3 | 4 | public static byte[] readBytesFromFile(File file) throws IOException {
byte[] bytes;
try (InputStream is = new FileInputStream(file)) {
long length = file.length();
if (length > Integer.MAX_VALUE) {
throw new IOException("Could not completely read file " ... |
1e1c26d9-290a-4513-84fa-9c4f7214c9f7 | 7 | @Override
public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
String data;
try {
ArrayList<FilterBean> alFilter = new ArrayList<>();
if (request.getParameter("filter") != null) {
if (request.getParameter("filterop... |
ccd920db-be7d-4802-9879-90ac1fe642d9 | 3 | public static final boolean AABB_point(Box b, Point p) {
return p.x >= b.x
&& p.x <= b.getMaxX()
&& p.y >= b.y
&& p.y <= b.getMaxY();
} |
35ba667c-3770-4ee9-8ed2-fea3549845c6 | 7 | private boolean isValidBlock(int[][] game, int x, int y, int testNumber) {
//declare variables referencing 3x3 block location in 9x9 grid
int blockX, blockY;
//determine row of 3x3 block being tested
if (x < 3)
blockX = 0; //rows 0, 1, 2
else if (x < 6)
... |
db5ebadc-a260-4106-ae16-4c599e4fa5a5 | 2 | public void goToImage(int index){
if(index < 0 || index >= history.size()) return;
historyIndex = index;
imagePanel.updatePanel(history.get(historyIndex));
imagePanel.update(imagePanel.getGraphics());
} |
1a1353ba-f9a5-4b6f-8b18-115e1f7db2f5 | 9 | static private void load() {
Timestamp startDay = Timestamp.valueOf("2011-01-01 00:00:00.0");
Timestamp nextDay = new Timestamp(startDay.getTime() + oneDayLong);
//final Timestamp endDay = Timestamp.valueOf("2011-09-01 00:00:00.0"); // !!!!!!! the first 8 months
final Timestamp endDay = Timestamp.valueOf("20... |
8e997fe8-e714-4f4d-b994-87298fc5422f | 7 | private void dragDivider(MouseEvent event) {
if (mDividerDragLayout != null) {
if (!mDividerDragIsValid) {
mDividerDragIsValid = Math.abs(mDividerDragStartX - event.getX()) > DRAG_THRESHOLD || Math.abs(mDividerDragStartY - event.getY()) > DRAG_THRESHOLD || event.getWhen() - mDividerDragStartedAt > DRAG_DELAY;
... |
ea1523fb-b4d7-4d7b-960a-0cf7940e3fff | 8 | public static boolean computeCell(boolean[][] world, int col, int row)
{
// liveCell is true if the cell at position (col,row) in world is live
boolean liveCell = getCell(world, col, row);
// neighbours is the number of live neighbours to cell (col,row)
int neighbours = countNeighbours(world, col... |
70e1c7c6-c02e-4387-bdb2-d9cb9959a9b8 | 9 | @Override
public void run() {
if (state == GameState.Running) {
while (true) {
bg1.update();
bg2.update();
robot.update();
hb.update();
hb2.update();
if (robot.isJumped()) {
currentSprite = characterJumped;
}
else if (robot.isJumped() == false && robot.isDucked() == false) {... |
5f84005b-b62f-4fb7-897d-30adab7e04ef | 3 | public static List<AstronomicalObject> sortByMass(List stm, int factor) {
List<AstronomicalObject> sorted = stm;
if (stm.size() > 0) {
if (factor < 0) {
Collections.sort(sorted, (B, A) -> MASS_COMPARATOR.compare(A, B));
log.info("SortedByMass descending :{}")... |
05f92ab5-87cd-464a-904f-98341b6aa140 | 8 | private boolean await0(long timeoutMillis, boolean interruptable) throws InterruptedException {
long startTime = timeoutMillis <= 0 ? 0 : System.currentTimeMillis();
long waitTime = timeoutMillis;
synchronized (lock) {
if (ready) {
return ready;
} else if... |
87027ea2-5a6e-43c3-9018-ea8a603cfd2d | 6 | public void removeEffects(Character character) {
if (!character.getBuffs().isEmpty()) {
for (SkillEffect effect : character.getBuffs()) {
effect.endEffect();
}
character.getBuffs().clear();
}
if (!character.getDebuffs().isEmpty()) {... |
998087a8-609d-49fb-a2bd-a08afdd56e66 | 5 | public byte[] pack() throws IOException {
byte[] footer = new byte[activeEntries * 10 + cSize + 2];
footer[0] = (byte) (activeEntries >> 8);
footer[1] = (byte) activeEntries;
int informationOffset = 2;
for(int i = 0; i < amountEntries; i++) {
if(archivePayloa... |
67a46c2a-e585-4d77-9125-1e55a5fdcf43 | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
do {
line = in.readLine();
if (line == null || line.length() == 0)
break;
int[] nn = retInts(line);
Seg... |
dd105c22-e032-4afa-a2a5-891f11a3a1f2 | 3 | public int getTeamSearchResult(String search){
PreparedStatement st = null;
ResultSet rs = null;
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT * FROM match_record_2013 where event_id = ? AND team_id = ?");
st.setInt(1, getSelectedEven... |
ed9f13fd-8de2-40d0-8213-4e9c67da73a0 | 5 | public static String removePrefix(String listenHostname, String hostname, boolean forward) {
if(hostname == null || listenHostname == null) {
return null;
}
listenHostname = listenHostname.trim();
hostname = hostname.trim();
if(hostname.startsWith(listenHostname)) {
hostname = hostname.substring(... |
e793d238-4fb9-40cc-afbe-359a2b6ac4ea | 0 | @Override
public IRemoteCallObjectData getDataObject() {
return data;
} |
94facffa-d345-429b-a25e-e00892a31875 | 1 | @GET
@Path("/v2.0/ports/{portId}")
@Produces({MediaType.APPLICATION_JSON, OpenstackNetProxyConstants.TYPE_RDF})
public Response showPort(@PathParam("portId") String portId, @HeaderParam("Accept") String accept) throws MalformedURLException, IOException{
if (accept.equals(OpenstackNetProxyConstants.TYPE_RDF)){
S... |
2add0c87-7e66-401a-801e-3f89444eed48 | 6 | private String getActiveModels() {
String s = "";
int modelNumber = 0;
int num = 0;
while (modelNumber < models.size()) {
if (models.get(modelNumber).getIsComplex()) {
ComplexModel c = (ComplexModel) models.get(modelNumber);
for (int i = 0; i <... |
ff433606-963b-4d31-89f9-58e12d9bd8b5 | 1 | public int getPixelSize(int boardWidth, int boardHeight) {
Dimension maxCanvas = getMaxCanvas();
int pixelWidth = maxCanvas.width / boardWidth;
int pixelHeight = maxCanvas.height / boardHeight;
int pixelSize;
if (pixelWidth <= pixelHeight) {
pixelSize = pixelWidth;
... |
ff6cdb09-f838-4d50-870d-aac3f14b3635 | 3 | public SingleTreeNode treePolicy(StateObservationMulti state) {
SingleTreeNode cur = this;
while (!state.isGameOver() && cur.m_depth < ROLLOUT_DEPTH)
{
if (cur.notFullyExpanded()) {
return cur.expand(state);
} else {
SingleTreeNode next ... |
4886a725-8ecf-4199-8969-e9e9028b668d | 8 | public static boolean isHydrophicChar( char inChar )
{
if ( inChar == 'A' || inChar == 'V' || inChar == 'L'
|| inChar == 'I' || inChar =='F' || inChar =='W'
|| inChar == 'M' || inChar == 'P')
return true;
return false;
} |
1ca54e88-0dc4-4fcf-9af8-43554272ae56 | 5 | public static int getIntLE(final byte[] array, final int index, final int size) {
switch (size) {
case 0:
return 0;
case 1:
return Bytes.getInt1(array, index);
case 2:
return Bytes.getInt2LE(array, index);
case 3:
return Bytes.getInt3LE(array, index);
case 4:
return Bytes.getInt4LE(... |
354eb344-77e7-49cf-bc2b-5b8eacc0dc8a | 1 | public static List<String> cloneList(List<String> list) {
List<String> clone = new ArrayList<String>(list.size());
for(String item: list) clone.add(item);
return clone;
} |
091218fa-d409-4e23-b9e9-331f8cf6be5d | 8 | public List<Tuple<Integer,Integer>> aStar ( Tuple<Integer,Integer> start, Tuple<Integer,Integer> goal) {
// Set closedSet = empty set
HashSet<Tuple<Integer,Integer>> closedSet = new HashSet<Tuple<Integer,Integer>>();
// The set of tentative nodes to be evaluated
HashSet<Tuple<Integer,Integer>> openSet = new Ha... |
02996435-fbaf-46c1-acc0-bdcc7f996805 | 6 | public Production[] getProductionsToAddForProduction(Production production,
Set lambdaSet) {
// Stupid...
/*
* ProductionChecker pc = new ProductionChecker(); String[] variables =
* production.getVariablesOnRHS(); ArrayList list = new ArrayList();
* for(int k = 0; k < variables.length; k++) {
* if(is... |
5eac313b-0e27-483f-9de5-2a87ca18c9ad | 1 | public long evaluate_long(Object[] dl) throws Throwable {
if (Debug.enabled)
Debug.println("Wrong evaluateXXXX() method called,"+
" check value of getType().");
return 0L;
}; |
5b6e3803-143f-4723-a06e-f11926039c83 | 1 | public void updateTitle(Dockable dockable) {
int index = mDockables.indexOf(dockable);
if (index != -1) {
mHeader.updateTitle(index);
}
} |
cb55c41b-49fe-4b21-9fab-75c5dd3a50fe | 0 | public PRFAlgorithmIdentifierType getPRF() {
return prf;
} |
347f0d41-ec81-47b6-9e68-6796e94519dd | 5 | private void writeFin(String user, int glID, String resName,
double cost, double cpu, double clock,
boolean header)
{
if (trace_flag == false) {
return;
}
// Write into a results file
FileWriter fwriter = null;
... |
a1fda48c-eabd-44d2-8e8b-f67c78e56097 | 1 | protected Class loadClass(final String className) throws ClassNotFoundException {
try {
return (Class)AccessController.doPrivileged(new PrivilegedExceptionAction(){
public Object run() throws Exception{
ClassLoader cl = Thread.currentThread().getContextClassLoader... |
d8c27cb5-ec43-4b8e-bf6e-aed87dad405a | 6 | * @param colony The <code>Colony</code> to pillage.
* @param random A pseudo-random number source.
* @param cs A <code>ChangeSet</code> to update.
*/
private void csPillageColony(Unit attacker, Colony colony,
Random random, ChangeSet cs) {
ServerPlayer attacke... |
4ae0a73d-379c-4e99-a281-c9cbc040f0b4 | 4 | private ActionListener createInviteROListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
PeerStatus status = LocalInfo.getPeerStatus();
if (!(status == PeerStatus.STARTER || status == PeerStatus.INVITEE)) {
... |
406758e7-6e33-4bba-bdc9-8e3ab81e8016 | 6 | public static void method335(int i, int j, int k, int l, int i1, int k1)
{
if(k1 < topX)
{
k -= topX - k1;
k1 = topX;
}
if(j < topY)
{
l -= topY - j;
j = topY;
}
if(k1 + k > bottomX)
k = bottomX - k1;
if(j + l > bottomY)
l = bottomY - j;
int l1 = 256 - i1;
int i2 = (i >> 16 & 0xff... |
5adf89a8-6742-429e-8f8f-bab8167a3e19 | 0 | public String getLabel() {
return this.label;
} |
119276a1-6ce7-47ec-8461-8f2059601e87 | 3 | @Override
public boolean equals(Object object) {
if (object instanceof SearchTerm) {
SearchTerm test = (SearchTerm) object;
return test.isCaseSensitive() == caseSensitive &&
test.isWholeWord() == wholeWord &&
test.getTerm().equals(term);
... |
0f2b7802-8762-4b23-8cc2-e6022eaa23eb | 6 | public static void loadScriptsFile(String name)
{
try {
File f = new File(name);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(f);
d... |
54b8c8e5-3b5a-4312-902a-935cda55241a | 3 | public static String decimalToBinary(int decimal) {
String binary = "";
while (decimal != 0) {
if (decimal % 2 == 0)
binary = "0" + binary;
else
binary = "1" + binary;
decimal = decimal / 2;
}
for (int i = binary.length(); i < 16; i++) {
binary = "0" + binary;
}
return binary;
} |
eddc9261-9528-4609-9d3f-8b3f351750f8 | 0 | public void close() throws IOException
{
target.close();
listener.done();
} |
fad265f9-ae65-4da7-9261-2a13ab615259 | 0 | public String getCode(final K symbol) {
return this.symbols.get(symbol);
} |
e0f4582d-841b-48a9-8fc6-e4cd0be5204f | 2 | public static byte menu(){
byte op=-1;
System.out.println("1.- Feu un programa en Java que demani el nombre de dades amb les quals es vol treballar (n), que les carregui en un array unidimensional real x i que:a) un cop introduïdes les dades les visualitzi per pantalla.b) calculi la mitjana, el valor més gran i el ... |
5576ef7e-e425-454b-a7d3-271062940f7b | 9 | private boolean backupStorage() {
new Thread() {
@Override
public void run() {
ProcessBuilder process = null;
Process pr = null;
BufferedReader reader = null;
List<String> args = null;
String line = null;
... |
12f3dbd6-d5dd-483e-8610-ecd430af1e7d | 2 | public static void main(String[] args) {
MessageConfig messageConfig=MessageConfig.parse(
XmlTest.class.getClassLoader().getResourceAsStream("demo.xml"));
System.out.println(messageConfig.toString());
for(Client client : messageConfig.getClient()){
System.out.println(... |
3fd86f65-ddd0-4fe1-b25a-5c1998e1ffc4 | 4 | public void alert(PrepareItemEnchantEvent e) {
if (Settings.logging) {
writeLog(e.getEnchanter().getDisplayName() + " tried to enchant a "
+ e.getItem().getType().toString().toLowerCase());
}
if (Settings.alertz) {
for (Player p : e.getEnchanter().getServer().getOnlinePlayers()) {
if (PermissionHan... |
d4444768-a91b-4c31-93f0-a1d8c1d8880b | 7 | Instantiation(final Instantiation prev, final BitSet sub) {
previous = prev;
subroutine = sub;
for (Instantiation p = prev; p != null; p = p.previous) {
if (p.subroutine == sub) {
throw new RuntimeException("Recursive invocation of " + sub);
... |
673b440c-3718-4b51-b3c1-9a15a71647c9 | 8 | public ExtDecimal ln(int scale, RoundingMode rm) {
if (type == Type.NUMBER) {
if (compareTo(ZERO) < 0) {
throw new ArithmeticException("Logarithm of a negative number in a real context");
} else if (compareTo(ZERO) == 0) {
throw new ArithmeticException("Lo... |
1ceecbdb-ab79-4ac5-942e-a4f0c5f1131d | 6 | private String generateFirstScan()
{
String tmp = new String();
for(int i = 0; i != lstInfoSchemaPair.size(); i++)
{
String name = lstInfoSchemaPair.get(i).getFirst();
String type = lstInfoSchemaPair.get(i).getSecond();
String typeGetMethod = type.substring(0, 1).toUpperCase() + type.substring(1);
tm... |
ec09b8d2-e6c8-427a-a209-8152e74a5e21 | 1 | @Override
public final ArrayList<Short> get(final Integer... a) {
final ArrayList<Short> r = new ArrayList<Short>();
for (final Integer i : a) { r.add(filter[i]); }
return r;
} |
70e0423a-50f8-4dd9-820d-22bd562b530e | 0 | public ImageIconCellEditor(JCheckBox checkBox, ImageIcon onIcon, ImageIcon offIcon) {
super(checkBox);
button = new JButton(offIcon);
button.setOpaque(true);
button.addActionListener(
new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
fireEd... |
e158d01a-6a4c-41db-81cc-4c038fbfae5e | 3 | @EventHandler
public void onInteract(PlayerInteractEvent e) {
if(e.getPlayer().getItemInHand().getType() == Material.FEATHER) {
if(e.getAction() == Action.LEFT_CLICK_BLOCK) {
PlayerSelections.pos1.put(e.getPlayer().getName(), e.getClickedBlock().getLocation());
e.getPlayer().sendMessage("Position 1 set!")... |
0954017f-b9fc-4e78-993c-8449068709fc | 0 | public void setFunFormaPago(String funFormaPago) {
this.funFormaPago = funFormaPago;
} |
6126050d-f516-477f-9264-80022aa23248 | 2 | public MethodInfo getMethod(String name) {
ArrayList list = methods;
int n = list.size();
for (int i = 0; i < n; ++i) {
MethodInfo minfo = (MethodInfo)list.get(i);
if (minfo.getName().equals(name))
return minfo;
}
return null;
} |
01db1a17-c805-40c3-8179-2116fe92cf9a | 4 | public void update(double tDelta) {
if (!stopped) {
double xUnclamped = curPos.getX() + tDelta * vX;
double yUnclamped = curPos.getY() + tDelta * vY;
curPos.setLocation(
vX > 0 ?
Math.min(xUnclamped, finalPos.getX())
:
Math.max(xUnclamped, finalPos.getX()),
vY > 0 ?
Math.min(... |
84de1f7f-92fc-447f-8ce5-4b6596b2f5cb | 4 | @Override
protected void paintComponent(Graphics oldG) {
super.paintComponent(oldG);
if (fullBoard == null) {
return;
}
//Calculate necessary cell width and height to fill panel
cellWidth = getWidth() / (fullBoard.getColumns() - (zoomFactor * 2));
cellHeig... |
c3e84617-4a11-43ed-8265-a2d8f6010d50 | 5 | public static String getDataReport(Table<Integer, String, Double> input) {
// check preconditions
Preconditions.checkNotNull(input);
Preconditions.checkArgument(input.column("N1").size() > 0, "expect a column N1 with data");
// header of the table
final StringBuilder result = new StringBu... |
20f3ec34-f21a-4126-b8f6-70f73e92c98c | 7 | private void ATTACK(Vector3f direction, float distance)
{
double time = (double)Time.getTime()/(double)(Time.SECOND);
double timeDecimals = time - (double)((int)time);
if(timeDecimals < 0.25)
{
material.setTexture(textures.get(4));
}
else if(timeDecimals... |
955e8606-5b13-45b7-aabc-1928732a4655 | 9 | public static void main(String[] args) {
Watch.start();
int[] q = new int[N + 1];
for (int i = 0; i <= N; i++)
q[i] = i;
boolean[] primes = new boolean[N + 1];
Arrays.fill(primes, true);
primes[0] = primes[1] = false;
for (int i = 2; i <= N; i++)
... |
8d61bbe1-0c54-4ed6-adc1-7461833a66f4 | 3 | public CheckStatus() {
byte[] byteArray = new byte[100];
int msgSize;
loadNativeLibrary();
// eZioLib.openport("6");
byte[] usbId = new byte[100];
eZioLib.FindFirstUSB(usbId);
eZioLib.OpenUSB(usbId);
eZioLib.sendcommand("^XSET,ACTIVERESPONSE,1");
... |
4df7f45c-06a6-4a4f-9c06-cb0032f37f82 | 5 | private void checkWinCondition()
{
boolean allCellsFlagged = true;
for (int x = 0; x<boardSize; x++) { //iterate through board
for (int y = 0; y<boardSize; y++) {
if (cells[x][y].getMined() && !cells[x][y].getFlagged()) { //if a cell with a mine hasn't been flagged, then the game can't have been won
a... |
30f20962-b21b-4e72-8090-dde9f27edc94 | 3 | public void openLink(final String url) {
if (!java.awt.Desktop.isDesktopSupported()) {
System.err.println("Desktop is not supported (Can't open link)");
return;
}
java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
if (!desktop.isSupported(java.awt.Desktop.Action.BROWSE)) {
Syst... |
e60c000a-b0ef-40a4-885a-6474b4258601 | 8 | public void buildClusterer(Instances instances) throws Exception {
// can clusterer handle the data?
getCapabilities().testWithFail(instances);
resultVector = new FastVector();
long time_1 = System.currentTimeMillis();
numberOfGeneratedClusters = 0;
replaceMissingValue... |
af61aae1-eeb5-4a3a-829f-ebbda4c7643d | 2 | public synchronized void put(T el) {
while (elements.size() == capacity){
try {
wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
elements.add(el);
notify();
} |
9c441719-9c36-477f-9fc2-86664127fb35 | 9 | public int getCloseRandomPlayer(int i) {
ArrayList<Integer> players = new ArrayList<Integer>();
for (int j = 0; j < Server.playerHandler.players.length; j++) {
if (Server.playerHandler.players[j] != null) {
if (goodDistance(Server.playerHandler.players[j].absX, Server.playerHandler.players[j].absY, npcs[i].a... |
e37fb151-c4b8-4ffe-b8c8-2e5083fa1527 | 9 | public int synthesis(Packet op){
Info vi=vd.vi;
// first things first. Make sure decode is ready
opb.readinit(op.packet_base, op.packet, op.bytes);
// Check the packet type
if(opb.read(1)!=0){
// Oops. This is not an audio data packet
return (-1);
}
// read our mode and pre/... |
cff14744-11ab-4d4c-9dee-3adcce06ab97 | 6 | public static int populateObjects(byte[] data, int offset, List dsftBinSpriteSetList, int entryCount, Class dsftBinSpriteClass)
{
Number recordSizeNumber = null;
try
{
Method getStaticRecordSizeMethod = dsftBinSpriteClass.getMethod("getStaticRecordSize", null);
record... |
44d868e0-2eae-4842-b265-d094cb3d6eae | 6 | private void drawGridlines(Graphics2D g2)
{
Rectangle curClip = g2.getClip().getBounds();
int top = getInsets().top, left = getInsets().left;
int miny = Math.max(0, (curClip.y - top) / (cellSize + 1)) * (cellSize + 1) + top;
int minx = Math.max(0, (curClip.x - left) / (cellSize + 1)... |
42da27ed-41aa-4ebe-905b-2da12c5438fe | 3 | public static void checkJMeterVersion() {
String[] currentVersion = StringUtils.split(Utils.getJmeterVersion(), ".");
String[] baseVersion = StringUtils.split("2.5", ".");
if (currentVersion[0].equals(baseVersion[0])) {
if (Integer.valueOf(currentVersion[1]) < Integer.valueOf(baseVe... |
1204e05c-6002-4d91-9454-43985e1ec8af | 2 | public void ignoreRecord(GedcomRecord rootRecord, GedcomReader reader)
throws IOException, GedcomReaderException {
int rootLevel = rootRecord.getLevel();
for (GedcomRecord record = reader.nextRecord(); record != null; record = reader
.nextRecord()) {
int level = record.getLevel();
if (level <= rootLe... |
dc0ae0b4-10f9-40a0-8f62-5f53d1188d60 | 8 | protected void func_72612_a(boolean par1)
{
int i = 0;
Iterator iterator = field_72616_e.iterator();
do
{
if (!iterator.hasNext())
{
break;
}
DatagramSocket datagramsocket = (DatagramSocket)iterator.next();
... |
3fd5e82e-e545-44dc-a472-f355bd8c6ce6 | 4 | public void update(Level level, int x, int y, int z, Random rand) {
if(!level.growTrees) {
int var6 = level.getTile(x, y - 1, z);
if(!level.isLit(x, y, z) || var6 != Block.DIRT.id && var6 != Block.GRASS.id) {
level.setTile(x, y, z, 0);
}
}
} |
9f487a09-0579-44bd-be12-34f9219d5c84 | 0 | public void remove()
{
q.clear();
} |
872e59de-9d6e-4972-b142-0e1d0b7f4405 | 8 | private boolean isModifierKey(int key) {
switch(key) {
case Keyboard.KEY_LSHIFT:
case Keyboard.KEY_RSHIFT:
case Keyboard.KEY_RIGHT:
case Keyboard.KEY_LEFT:
case Keyboard.KEY_DOWN:
case Keyboard.KEY_UP:
case Keyboard.KEY_LCONTROL:
case Keyboard.KEY_RCONTROL:
return true;
default:
return false;
... |
c5c00b6f-e8fa-47d8-9815-a44d32a69e06 | 9 | public ArrayList<Query> getQueries(String queryFileName) {
ArrayList<Query> queryList = new ArrayList<Query>();
Query query = new Query();
FileReader fileReader;
try {
fileReader = new FileReader(queryFileName);
BufferedReader reader = new BufferedReader(fileReader);
String line;
try {
while ((... |
a9a76e93-c5a4-4380-aac1-c5eef530cc4d | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
stack[top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
this... |
1fd3dc67-57eb-4bec-8f29-71b90414b5a9 | 0 | public void setY2Coordinate(double y)
{
y2Coordinate=y;
} |
4e6a9b6e-5992-404e-b78b-d4cd230b7474 | 4 | public JSONWriter key(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
this.stack[this.top - 1].putOnce(string, Boolean.TRUE);
if (this.comma) {
... |
bb84728f-aa61-4bc0-a5ac-2f2f20efccd8 | 7 | private void initDataLayout(File file) throws IOException {
if (file.exists()) { // Load the data formats from the file
byte[] buffer = new byte[32];
mappedByteBuffer.get(buffer);
ByteBuffer bbuffer = ByteBuffer.wrap(buffer);
int index;
if ((inde... |
2bcfde19-d528-4032-b5d6-6f0304d07b7d | 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 fe... |
ed72fe62-732e-44e1-9c31-8c439009e587 | 1 | @Override
public void actionPerformed(ActionEvent event) {
Duplicatable duplicatable = getTarget(Duplicatable.class);
if (duplicatable != null) {
duplicatable.duplicateSelection();
}
} |
7e1092f9-29c3-45d9-938c-b1ca3e861e44 | 2 | @Override
public void startElement( String uri, String localName, String name,
Attributes attributes ) throws SAXException {
XElement element = new XElement( name );
if( this.element == null ){
this.element = element;
}
else{
... |
aeb69a8a-90bd-4cba-9b8b-91f87edf156f | 4 | public ConfigurationHolder getExactRegion(String world, String name) {
for (ConfigurationHolder holder : this) {
if (holder.getType() == ConfigurationType.REGION)
if (holder.getWorld().equalsIgnoreCase(world))
if (holder.getName().equalsIgnoreCase(name))
return holder;
}
return null;
} |
2d117476-7dbf-4d5b-884f-7c1020747d39 | 9 | private static List<List<Livraison>> kmeans(List<Livraison> livraisons, int k)
{
List<List<Livraison>> clusters = new ArrayList<List<Livraison>>();
for(int i = 0 ; i < k ; i++)
{
clusters.add(new ArrayList<Livraison>());
}
List<Double> centroidX = new ArrayList<Double>();
List<Double> centroidY = new Ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.