method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
1d4de6b8-c95d-472c-809d-22f43e505f1a | 0 | public void setReplace(int i, String s) {
this.replaces.set(i, s);
} |
f826e8b2-21c9-41a6-8a69-5aedbd075639 | 6 | public void checkWar() {
if(bb.size()>0){
for (int i = 0; i < bb.size(); i++) {
Barb b = (Barb)bb.get(i);
if(grid[b.getX()][b.getY()]==4) {
System.out.println("Farm contact");
setBlock(b.getX(),b.getY(),3);
M... |
efbb4e01-326e-4056-aaa6-9d6875b7809d | 7 | private AlgebraicParticle constructExpression(boolean sign, ArrayList<AlgebraicParticle> list, int exponent) {
if(list.size() == 0) {
//if the exponent isn't one then it needs to be carried over to the number
if(exponent != 1) return Number.ZERO.cloneWithNewSignAndExponent(sign, exponent);
return Number.ZERO... |
fc23da77-0465-41ad-ba6a-f855c73c70fd | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
589dbd73-b90b-46f4-9e47-63acdbed2ade | 0 | public void setInputStream(InputStream inputStream) {
this.inputStream = inputStream;
} |
2d35c2e3-16d4-48f4-9335-f7dbcd5f4809 | 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... |
bb94c650-5b8f-40df-a224-6154856c7446 | 6 | public static int loadProgram(String path, String vertexName, String fragmentName) {
int program = glCreateProgram();
int vertex = glCreateShader(GL_VERTEX_SHADER);
int fragment = glCreateShader(GL_FRAGMENT_SHADER);
StringBuilder vertexSource = new StringBuilder();
StringBuilder fragmentSource = new String... |
d0c3ba26-d430-4365-927d-352d4e773cd3 | 0 | public void setOwner(Owner o){
owner = o;
} |
421f5084-69da-4a0e-b685-4124b011f83d | 3 | public byte[] serialize() {
// 6 bytes for mac
byte[] serialized = new byte[1 + data.length + 13];
serialized[0] = (byte) type.ordinal();
serialized[1] = (byte) ttl;
byte[] mac = getMacAsBytes(this.receiverMac);
for (int i = 2; i <= 7; i++) {
serialized[i] = mac[i - 2];
}
mac = getMacAsBytes(this... |
d95f97e1-aa2a-4903-a1c6-f0b29bf2f6b8 | 2 | public void setSelected( Selection selection ) {
SelectableCapability capability = getCapability( CapabilityName.SELECTABLE );
if( capability != null ) {
Selection old = capability.getSelected();
if( !old.equals( selection ) ) {
capability.setSelected( selection );
}
}
} |
b4ab8e42-2947-452d-94e9-6998ae86cf9e | 1 | public void show(TreeNode node) {
if (defaultVisible)
visibleNodes.remove(node);
else
visibleNodes.put(node, null);
} |
d1be88c9-5113-44ea-b55b-407dd0aae040 | 3 | synchronized void unlockContext(int x, int z)
{
for (int xx = 0; xx < 3; xx++)
for (int zz = 0; zz < 3; zz++)
{
Chunk c = getChunk(x + xx - 1, z + zz - 1);
if (c != null)
c.opLock.unlock();
}
taskQueue.addAll(loc... |
f9190d85-15f6-4770-bd1a-e2ca51e0cd3e | 9 | public static void main(String[] args) {
BoardInterface board = new Board();
BoardViewer boardViewer = new BoardViewer();
board.initializeBoard(3);
boardViewer.setViewedBoard(board);
Score score = new Score();
Output oc = new OutputImpl(new ConsoleDisplay());
Player player1 = new HumanPlayer(new P... |
d72ec655-1106-41f8-a385-16ff101c56ce | 2 | @Override
public BufferedImage generate() {
BufferedImage completePic = new BufferedImage(xSize, ySize,
BufferedImage.TYPE_INT_RGB);
for (int i = 0; i < xSize; i++) {
for (int j = 0; j < ySize; j++) {
Color newPixel = colGen.getPixel();
completePic.setRGB(i, j, newPixel.getRGB());
}
}
return ... |
d4672f9e-ca34-4a24-ba9b-0526a3c01194 | 1 | public void newFiles(File file, FilterPanel searchPanel) {
MP3Container temp = showCon;
mainCon.add(file, searchPanel);
if (temp == showCon) {
update();
}
} |
61677cbb-bfaf-444e-b436-bf5cb6145122 | 9 | private void recieveHandshake() throws IOException {
ByteBuffer ch = ByteBuffer.allocate((this.remoteHandshake != null ? this.remoteHandshake.capacity() : 0) + this.buffer.capacity());
if (this.remoteHandshake != null) {
this.remoteHandshake.rewind();
ch.put(this.remoteHandshake)... |
425617bc-d051-4f8e-aa5e-3f659e3b4043 | 4 | @Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
if (kirjaudutaankoUlos(request)) {
kirjauduUlos(request, response);
} else if (... |
bd0d00db-d758-464c-a96b-d37214a42b55 | 6 | public static void main(String[] args) {
BufferedReader reader;
File file = new File("D:/www/tmp/10.183.131.236-20150309-php_2701sell.log");
String root = "d:/www/tmp/";
Map<String, FileWriter> fileWriteMap = new HashMap();
String[] typeArray = new String[]{"tid"};//$act, $value,... |
f1219ed5-9459-4290-b0d0-ce618899c31e | 8 | @Override
public void shade(Color outIntensity, Scene scene, Ray ray, IntersectionRecord record, int depth) {
// TODO: fill in this function.
// You may find it helpful to create helper methods if the code here gets too long.
Vector3 outgoing = new Vector3(ray.direction);
outgoing.scale(-1);
outgoing.normali... |
423dafe8-8331-4a10-9701-4ab2159b693c | 9 | public void processFire(Bullet bullet) throws Exception {
this.bullet = bullet;
int step = 1;
while ((bullet.getX() > -14 && bullet.getX() < 590) && (bullet.getY() > -14 && bullet.getY() < 590)) {
if (bullet.getDirection() == Direction.UP) {
bullet.updateY(-step);
} else if (bullet.getDirection() == Dir... |
30f7724b-f160-48e8-93eb-ddf51a4f40a1 | 5 | public boolean checkNeighbors(mxGraph graph, Object edge, Object source,
Object target)
{
mxIGraphModel model = graph.getModel();
Object sourceValue = model.getValue(source);
Object targetValue = model.getValue(target);
boolean isValid = !validNeighborsAllowed;
Iterator<String> it = validNeighbors.iterato... |
c34ef886-7dfb-46bd-b7e3-edfacee26d1a | 6 | public Object getValueAt(int rowIndex, int columnIndex) {
switch (columnIndex) {// parcour par colonne
case 0://colonne id_Stock
return medicaments.get(rowIndex).getId_mdc();
case 1://colonne id_Stock
return medicaments.get(rowIndex).getRef();
... |
d9aca9ae-cb3f-4bfd-8701-eba91d0a3fb7 | 3 | public boolean removeClientConnected(ServerHandleConnect serverHandleConnect) {
for (int i = 0; i < this.serverHandleConnectList.size(); i++) {
if (serverHandleConnectList.get(i) == serverHandleConnect) {
serverHandleConnectList.remove(i);
this.curconnected--;
}
}
if (this.curconnected <= 0) {
re... |
39ce1aac-c092-4e00-b293-87997107dd67 | 8 | private char[] generatePasswd(char []inputval) throws IOException {
char[] lineBuffer;
char[] buf;
int i;
buf = lineBuffer = new char[128];
int room = buf.length;
int offset = 0;
int c;
int index = 0;
int lenofinputval = inputval.length;
System.out.println("D... |
4e358f4f-862c-4ced-b967-5979473857d7 | 6 | @Test
public void testLexer()
{
Random rand = new Random();
List<TokenType> types = new ArrayList<TokenType>();
StringBuilder sb = new StringBuilder();
final int max = TokenType.values().length;
for(int i = 0; i < 10000; i++)
{
TokenType type = TokenType.values()[rand.nextInt(max)];
types.add(type)... |
14c24648-e7d0-421a-8635-9ee65b83d5b8 | 0 | public String getDate() {
return date;
} |
91cee135-301a-471e-9685-81ee174ef34b | 5 | private static void loadEventsFromFile() throws FileNotFoundException, IOException {
File eventsTxt = new File("events.txt");
if(!eventsTxt.exists()){
eventsTxt.createNewFile();
}
try(BufferedReader br = new BufferedReader(new FileReader("events.txt"))) {
StringBuilder sb = new StringBuilder()... |
a2330b26-8a6a-40f5-8f46-18c4f843d9d3 | 6 | public boolean stop() {
if (!(started)) {
return false;
}
started = false;
plugin.getBroadcaster().alertEveryone(this, "The game is over!");
if (taskId != -1) {
plugin.getServer().getScheduler().cancelTask(taskId);
taskId = -1;
}
for (String player : deadPlayers) {
Player p = plugin.getServer(... |
1b817be6-b677-4eec-8c24-5fab67a8ce93 | 7 | private void populateData() {
String sharedDir = Configuration.getConfig(Configuration.CONFIG_SHARED_FILESYSTEM_PATH);
String cluster = Configuration.getConfig(Configuration.CONFIG_SGE_CLUSTER);
String location = Configuration.getConfig(Configuration.CONFIG_SGE_ROOT);
String sp... |
aa532961-ce55-48a3-9460-974382a939a4 | 2 | public final void reserve(int count) throws VerifyException {
if (stackHeight + count > maxHeight) {
maxHeight = stackHeight + count;
if (maxHeight > stack.length)
throw new VerifyException("stack overflow");
}
} |
61efa919-1d48-4cb6-b9be-c204330e6a83 | 8 | public void drawPalette(int spanInPixels, TerrainTypes terrain, Vector<Boolean> desiredFeatures) {
String[] features = {"Bonus","Road","Railroad","Irrigation","Village","City"};
String[] abbr = {"+", "", "", "i", "V", "1"};
features[0] = terrain.getBonusDescription(... |
8b27f0d3-4f8a-4779-b2cb-2a13374099c9 | 5 | public static List<Class<?>> getAllInterfacesIncludingSuper(Class<?> c)
{
ArrayList<Class<?>> res = new ArrayList<Class<?>>();
while (c != null)
{
res.addAll(getAllInterfaces(c));
c = c.getSuperclass();
}
return res;
} |
d022b014-99b9-49a0-a33a-a8fc22ab9974 | 4 | public void setState(ShotType shotType)
{
type = shotType;
switch(type)
{
case PISTOL:
body.setMass(1.5d);
body.setVelocity(new Vector3d(0.0d, 0.0d, 20.0d));
body.setAcceleration(new Vector3d(0.0d, -0.5d, 0.0d));
body.setDamping(0.99d, 0.8d);
radius = 0.2d;
break;
case ARTI... |
19a382ee-e5ce-4861-941d-d09027b2e425 | 1 | private static ArrayList<int[]> rleToList(RunLengthEncoding rle) {
ArrayList<int[]> runs = new ArrayList<int[]>();
for (RunIterator it = rle.iterator(); it.hasNext();)
runs.add(it.next());
return runs;
} |
752da015-336f-42d7-baee-e8273c207e2d | 0 | public SchlangenGlied getPreviousGlied() {
return previousGlied;
} |
764351b6-f7b3-4c5b-82c8-cee24d498478 | 7 | public boolean nonIPnonMonsterWithMe(MOB me)
{
if((me.location()!=null)&&(me.session()!=null))
{
final Room R=me.location();
for(int i=0;i<R.numInhabitants();i++)
{
final MOB M=R.fetchInhabitant(i);
if((M==null)||(M==me))
continue;
if((M.session()!=null)&&(M.session().getAddress().equals... |
314c9b09-3b9b-4b7a-ab8c-d73ff4bd2b66 | 5 | @Override
public void render(Graphics g) {
for(int y = 0; y < tiles[0].length; y++)
for(int x = 0; x < tiles.length; x++)
perspective.render(g, tiles[x][y]);
for(int y = 0; y < tiles[0].length; y++)
for(int x = 0; x < tiles.length; x++)
for(Entity entity : tiles[x][y].getEntities())
perspective... |
dff023f5-0454-4cb4-ab60-e14fd484ff75 | 0 | public JButton getjButtonPrevious() {
return jButtonPrevious;
} |
388e9043-0823-4c4e-a786-6ff9b98ae901 | 0 | @Override
public boolean isManagingFocus() {return true;} |
0a44c461-aa95-4c40-ba6d-85a2564eaa84 | 8 | private void profileListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_profileListMouseClicked
// Handles right clicks and double clicks on the Profile List
if(evt.getClickCount() == 2){
try {
if(evt.getX() <= 16){
// Clicked on the icon
... |
c5e8f205-b84e-4ff7-a9f5-fb0cb4334065 | 6 | public void mouseMoved(MouseEvent e)
{
if (!gameWon && board.getWhoseTurn() == 2)
{
mouseX = e.getX();
mouseY = e.getY();
if (mouseX > grid.getGridX() + grid.getDiameter()/2 && mouseX < grid.getGridX() + grid.getGridWidth() - grid.getDiamet... |
19dbb4ff-2ec7-4ca0-9ff8-aec30927ccb6 | 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... |
ea871754-3732-4581-9645-1093561867c5 | 4 | private byte[] get_img_stream(File dot, String type)
{
File img;
byte[] img_stream = null;
try {
img = File.createTempFile("graph_", "."+type, new File(GraphViz.TEMP_DIR));
Runtime rt = Runtime.getRuntime();
// patch by Mike Chenault
String[] args = {D... |
3977afd1-fec0-439c-87bc-80273f388851 | 8 | public void installEditPolicy(Object key, EditPolicy editPolicy) {
Assert.isNotNull(key, "Edit Policies must be installed with keys");//$NON-NLS-1$
if (policies == null) {
policies = new Object[2];
policies[0] = key;
policies[1] = editPolicy;
} else {
int index = 0;
while (index < policies.length &... |
b6fada41-031f-4972-9df8-1623786db784 | 2 | private Class getCommandClass(HttpServletRequest request) {
final String CLASS_PATH = "com.study.vital.webApp.commands.";
Class result;
final String commandClassName;
if(request.getParameter(Attributes.COMMAND)==null){
commandClassName = CLASS_PATH;
} else {
... |
226246a9-77d4-44aa-8989-63a86f4cf077 | 3 | @Override
public void updateLong() {
super.updateLong();
if(generationTimerEnd == 0) {
resetGenerationTimer();
}
if(generationTimerEnd <= System.currentTimeMillis() && this.isActivated()) {
placeableManager.playerAddItem("Platinum", 1);
... |
57d9e1e2-e69a-44ee-b04b-065f8449a752 | 5 | private void attemptLogin(){
name = tfUsername.getText();
password = new String(pfPassword.getPassword());
if(name.isEmpty()||password.isEmpty()){
tfUsername.setText("");
lblLoginError.setText("Incorrect Login Credentials");
}
else{
ip = tfServerIp.getText();
int connected = co... |
ef3f68e9-bcb1-4ec5-b829-ea6552d5a5e3 | 5 | private void registerActionListeners() {
view.btnSave.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean written = false;
Object[] options = { "Yes", "No" };
int result = JOptionPane.showOptionDialog(null, "Would you like to save your level?", "Save", JOptionP... |
3726faa6-5f96-4e95-8b54-0170420d9443 | 8 | private void deleteCase5(RBTreeNode<K,V> node) {
if (node == node.parent.left &&
nodeColor(node.sibling()) == Color.BLACK &&
nodeColor(node.sibling().left) == Color.RED &&
nodeColor(node.sibling().right) == Color.BLACK) {
node.sibling().color = Color.R... |
38d24879-16dc-4995-b736-74171de45502 | 9 | private void processNodeTag(Attributes attributes) {
byte[] node = null;
long lastTS = 0;
short lastClockSeq = 0;
for (int i = 0; i < attributes.getLength(); i++) {
String attributeName = attributes.getLocalName(i);
if ("".equals(attributeN... |
6a6df21d-eaa5-47cc-9686-68a880e6e6e1 | 3 | public SynchronizedLyric(String text, int timeStamp)
{
if (text == null || text.trim().length() == 0)
throw new IllegalArgumentException("The text field in a synchronized lyric, " + text + ", in the " + FrameType.SYNCHRONIZED_LYRIC_TEXT.getId() + " frame may not be empty.");
if (timeStamp < 0)
... |
49aa5607-b79b-4e95-aaf2-0f9c1862b810 | 7 | public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
String input= userNameField.getText();
if (OK.equals(cmd) && !input.trim().equals("")) {
if (checkAccount(input)==true) { //if account exists
controllingFrame.setVisible(false);
... |
bc64d49a-7d0e-4ef4-89c0-db58506a3d35 | 4 | public static void merge(int[] result, int[] left, int[] right) {
int i1 = 0; // index into left array
int i2 = 0; // index into right array
for (int i = 0; i < result.length; i++) {
if (i2 >= right.length || (i1 < left.length &&
... |
85b8b4c2-a398-489a-bf3a-6aad0db55dce | 9 | void addTriangle(int vertexA, int vertexB, int vertexC) {
if (vertexValues != null
&& (Float.isNaN(vertexValues[vertexA]) || Float.isNaN(vertexValues[vertexB]) || Float
.isNaN(vertexValues[vertexC])))
return;
if (Float.isNaN(vertices[vertexA].x) || Float.isNaN(vertices[vertexB].x) || Float.isNaN(vertic... |
d06af24d-15c0-4f19-8657-05adb5db1b26 | 0 | @Override
public String toString()
{
return String.format( "or(%s, %s)", this.a, this.b );
} |
10478b73-1ef0-469b-ab1c-eadd4285c530 | 7 | public boolean shellCollideCheck(Shell shell)
{
if (deadTime != 0) return false;
float xD = shell.x - x;
float yD = shell.y - y;
if (xD > -16 && xD < 16)
{
if (yD > -height && yD < shell.height)
{
world.sound.play(Art.samples[Art.SAMP... |
fcce2382-f3fd-41af-9450-076361c68bf2 | 8 | public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) {
byte b0 = 4;
byte b1 = 16;
byte b2 = 63;
int k = b0 + 1;
byte b3 = 17;
int l = b0 + 1;
this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGe... |
cb70e920-ddc1-4da6-8f9b-5503b2ec90f5 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CarsModel carsModel = (CarsModel) o;
if (idCars != carsModel.idCars) return false;
if (makeId != carsModel.makeId) return false;
if (mo... |
555eaed2-8d82-411f-bf2e-88a628e3b687 | 6 | public Vector findPointForWall(double x, double y){
double xRes = -1, yRes = -1,r = 100000;
for (Wall wall:walls){
if (sqrt((x - wall.getX1()) * (x - wall.getX1()) + (y - wall.getY1()) * (y - wall.getY1())) < RADIUS_TO_DETECT_WALL_POINT &&
r > sqrt((x - wall.getX1()) * (... |
9969ba6b-cd56-4bd6-932e-e655dfa82b08 | 0 | public IBomber getOwner() {
return owner;
} |
7dce4653-f1e7-4b76-ae2b-c09f60845fb7 | 5 | private long getNext() {
boolean primeFound = false;
if (numPrimesFound == 0) {
primesFound.add(2l);
maxPrimeFound = 2;
numPrimesFound = 1;
maxNumberSearched = 2;
return (long) 2;
}
for (long i = maxNumberSearched+1; !primeFound; i++) {
// test if i is prime
// divide by all primes <= sqr... |
3a4ddb49-a8be-4d93-be3e-35da3d4c3c73 | 1 | public void makePlain() {
if (this.isDisposed()) {
return;
}
isBold = false;
setFont(null);
} |
12d9e9c0-4b00-4804-bdd1-ed8c0a8706a0 | 0 | public SizedStack(int size) {
super();
this.maxSize = size;
} |
a18e133e-d49a-418a-a15d-63b3d26644b1 | 1 | public static void main(String[] args) {
TransferQueue<String> stringTransferQueue = new LinkedTransferQueue<>();
try {
stringTransferQueue.put("Await receipt");
} catch (InterruptedException e) {
e.printStackTrace();
}
TransferQueueExample transferQueue =... |
90c4073f-f41d-44af-8f3b-1daa8a3b6bdf | 2 | public static void main( String[] args )
{
int loopLimit = 100;
int count = 0;
while ( count < loopLimit )
{
if ( count % 2 == 0 )// check if the "count" is completely divisible by 2
{
System.out.println( count );
}
cou... |
6842bfa6-c361-4688-bb9a-95a881672f85 | 9 | public static Cons cppGetMethodDefinitions(Stella_Class renamed_Class, Object [] MV_returnarray) {
{ Cons publicmemberfuncdefs = Stella.NIL;
Cons protectedmemberfuncdefs = Stella.NIL;
{ Slot slot = null;
Cons iter000 = renamed_Class.classLocalSlots.theConsList;
for (;!(iter000 == Stell... |
2234d6f5-c6be-4217-804d-1390e6ad8d24 | 8 | public void settime (String s)
{
StringParser p = new StringParser(s);
if ( !p.skip("Game")) return;
int g = p.parseint();
if (p.error()) return;
p.skipblanks();
if ( !p.skip("I:")) return;
String w = p.parseword();
p.skipblanks();
if ( !p.skip("(")) return;
int w1 = p.parseint();
int w2 = p.pars... |
56dbc6b4-71c0-4590-a559-16c7cb87c3dc | 9 | @Override
public String toString() {
final int maxNumber = m.length * m.length - 1;
final int fieldLength =
Math.max(5, (int)(Math.floor(Math.log10(maxNumber))) + 1);
final StringBuilder sb = new StringBuilder();
final StringBuilder ALL = new StringBuilder(8... |
04a188f8-a5cf-4bd6-ab34-465a95c04347 | 1 | private TrainNumber CreateK600K597() {
TrainNumber rs = new TrainNumber();
rs.setId(UUID.randomUUID());
rs.setName("K600/K597");
Route route = new Route();
route.setId(UUID.randomUUID());
route.setStartDate(new LocalDate(0L));
route.setEndDate(LocalDate.now().plusYears(10));
rs.getRoutes().a... |
db3d3437-61d9-4831-b47c-62b9b9992bcd | 5 | public String toString() {
int reporterGroupSize = -1;
if (reporterGroup != null) {
reporterGroupSize = reporterGroup.size();
}
int blGroupSize = -1;
SampleGroup baselineGroup = getBaselineGroup();
if (baselineGroup!=null) {
blGroupSize = baselineGroup.size();
}
Sa... |
95849ea2-3e2c-4559-9d22-ac8a6830cf98 | 3 | private static void fw_write(String msg, String file)
{
//System.out.print(msg);
FileWriter fwriter = null;
try
{
fwriter = new FileWriter(file, true);
} catch (Exception ex)
{
ex.printStackTrace();
System.out.println("Unwanted err... |
194844b7-0bc2-4d92-89d2-78c7ce7d9e20 | 6 | FormAttachment setAttachment (String attachment) {
String control, align;
int position, offset;
int comma = attachment.indexOf (',');
char first = attachment.charAt (0);
if (Character.isLetter(first)) {
/* Case where there is a control */
control = attachment.substring (0, comma);
int i = 0;
while... |
9388124f-0d65-45d2-bde4-c7c1d709bae0 | 4 | @Override
public void disablePlugin(Plugin plugin) {
Validate.isTrue(plugin instanceof InjectablePlugin, "Plugin is not associated with this PluginLoader");
if (plugin.isEnabled()) {
String message = String.format("Disabling %s", plugin.getName());
plugin.getLogger()... |
efc38b38-6820-41d7-9b64-d64427df4956 | 8 | private void saveLibraryEntry(LibraryEntry libraryEntry, List<SlateObject> filterList, boolean saveChallengeMonster)
{
List<Piece> pieces = new ArrayList<Piece>();
Iterator<Entry<Integer,Map<Long,SlateObject>>> iterator = slateComponent.getObjectMap().entrySet().iterator();
while (iterator.hasNext())
{
En... |
95cf8dc2-8dd3-4f68-bff5-a7990efd001c | 9 | private static Cell construct(Sequence s1, Sequence s2, float[][] matrix,
float o, float e, byte[] pointers, short[] lengths) {
logger.info("Started...");
char[] a1 = s1.toArray();
char[] a2 = s2.toArray();
int m = s1.length() + 1; // number of rows in similarity matrix
... |
85885370-506c-430c-8891-3ec2e5d3940b | 3 | public ByteBuffer getBuffer(){
if(this.currentBufferQueue == null){
this.currentBufferQueue = new ConcurrentLinkedQueue<ByteBuffer>();// 当前正在处理的缓冲区队列
}
if(this.currentByteBuffer == null || this.currentByteBuffer.remaining() <= 0){
this.currentByteBuffer = BufferPool.getInstance().getBuffer();
this.... |
d1601f9f-bfd5-46af-84d3-ef553a16b122 | 3 | public List<Integer> determinePrizePool() {
List<Integer> tempList = new ArrayList<Integer>();
int numu = getAllUsers().size();
if (numu <= 0) { // no users
return null;
} else if (numu == 1) {
// one user, he gets the whole pool
tempList.add(getTotalAmount());
} else if (numu == 2) {
// two ... |
a98aa54d-2b76-4ffc-8e33-2dde36b61c60 | 8 | public void visit_dload(final Instruction inst) {
final int index = ((LocalVariable) inst.operand()).index();
if (index + 2 > maxLocals) {
maxLocals = index + 2;
}
if (inst.useSlow()) {
if (index < 256) {
addOpcode(Opcode.opc_dload);
addByte(index);
} else {
addOpcode(Opcode.opc_wide);
... |
fb49dec9-08bf-4e04-a1d5-e6cfb6185181 | 8 | public int removeDuplicates(int[] A) {
int length = A.length;
int i =0;
while (i < length)
{
if (i < length -1 && A[i] == A[i+1])
{
i++;
}
int j = i + 1;
while (j <= length -1 && A[j] == A[j-1])
{
j++;
}
if (j == len... |
748f6099-850a-42af-a373-755018b635bb | 8 | private void setupDocumentLayer ( )
{
documentPresentationLayer = new DefaultStyledDocument()
{
private static final long serialVersionUID = 1L;
public void insertString (int offset, String str, AttributeSet a) throws BadLocationException {
super.insertString... |
ba883f58-338b-4225-80c5-5c383ca3ff85 | 3 | public ArrayList getAttributeList(Filter filter)
{
// check for errors first
int rcID = getReplicaCatalogueID();
if (filter == null || rcID == -1) {
return null;
}
ArrayList attrList = null;
int eventTag = DataGridTags.CTLG_FILTER;
Object[] packet... |
a44f9257-7533-4b70-b833-35d3d26f2694 | 3 | public static int pideInt(String texto) {
InputStreamReader flujo=new InputStreamReader(System.in);
BufferedReader teclado=new BufferedReader(flujo);
String cadnum;
int numero=0;
boolean correcto;
do {
try {
correcto=true;
... |
a3e07c26-d93b-4c00-96b4-9adb1580fa7b | 4 | void radb3(int ido, int l1, final double cc[], double ch[],
final double wtable[], int offset)
{
final double taur=-0.5D;
final double taui=0.866025403784439D;
int i, k, ic;
double ci2, ci3, di2, di3, cr2, cr3, dr2, dr3, ti2, tr2;
int iw1, ... |
be8ebef9-62ac-43bd-9114-2b6b3516b09f | 0 | public IntegerGenerator(String tableName, String columnName, int start) {
super(tableName, columnName);
this.start = start;
this.current = start;
} |
e676f5b2-d6f6-4de0-a0d6-54a393c4e637 | 5 | @Override
public float millisecondsPlayed()
{
// get number of samples played in current buffer
float offset = (float)AL10.alGetSourcei( ALSource.get( 0 ),
AL11.AL_BYTE_OFFSET );
float bytesPerFrame = 1f;
switch( ALformat )
... |
2ba50814-fbcf-4ad5-844e-66f5ef668f88 | 6 | private void infect() {
for (int i = 0; i < Integer.parseInt(Config
.getProperty("Grid.Infected")); i++) {
// Position x
int x = (int) (grid.getWidth() * Math.random());
// Position y
int y = (int) (grid.getDepth() * Math.random());
... |
8aee5bfe-8911-4e88-b98e-8c038331adef | 9 | public boolean isWalls(){
if(this.heading%(Math.PI/2)!=0) return false;
if((this.x>=17 && this.x<=19) || (this.x>=781 && this.x<=783) || (this.y>=17 && this.y<=19) || (this.y>=581 && this.y<=583) ) return true;
return false;
} |
96dff2b6-454b-4711-9477-fa4b4fbccb4b | 9 | public void traverseTree(IHuffmanNode node, int[] word, int depth, HeaderInfo headerInfo) {
//empty node
if (node == null)
return;
//Node is leaf, attach code
if (node.isLeaf()) {
((Word) node.getWord()).setOutputParam(
word,
... |
fe37f935-98dd-4efb-b3d9-3df6688e960f | 8 | @Override
public void changeImage(ImageMovementState movementState, ImageRotationState rotationState)
{
switch (movementState)
{
case Idle:
imageMovementState = ImageMovementState.Idle;
switch (rotationState)
{
cas... |
a286d001-6a74-447e-adc2-c8baaa5105c8 | 0 | public void setDetermineImageNumber(boolean newValue)
{
determineNumberOfImages = newValue;
} |
075ed919-0a97-467c-87ad-2da84ea55b82 | 5 | public int getEncodedMotorPosition(int motor)
{
if (!isConnected())
{
error("Robot is not connected!", "RXTXRobot", "getEncodedMotorPosition");
return -1;
}
if (!getOverrideValidation() && (motor < RX... |
c0127fe3-6af7-48f6-8099-f77a145fffdf | 4 | public void testDajZauzeteSobe() {
java.util.Date datumOD= new java.util.Date();
java.util.Date datumDO= new java.util.Date();
java.util.Date rezervisanoOD= new java.util.Date();
java.util.Date rezervisanoDO= new java.util.Date();
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd");... |
fdd656bf-3798-4fe5-b494-3a707dd1db1c | 8 | public static Class<?> findCommonElementType(Collection<?> collection) {
if (isEmpty(collection)) {
return null;
}
Class<?> candidate = null;
for (Object val : collection) {
if (val != null) {
if (candidate == null) {
candidate = val.getClass();
} else if (candidate != val.getClass()) {
... |
0312cd66-fc28-4206-a1cd-b75e294a22db | 4 | @Override
public void nodeDataChanged(ZVNode node) {
boolean updateView = false;
if (nodes != null) {
for (int i = 0; i < nodes.length; i++) {
if ((nodes[i] == node)) {
updateView = true;
}
}
... |
09614c62-7f18-4245-b22f-60fdcfd844b2 | 3 | public List getNextElements(int count)
throws IteratorException {
int i = 0;
Object object = null;
LinkedList list = new LinkedList();
if (listIterator != null) {
while (listIterator.hasNext() && (i < count)) {
object = listIterator.next();
list.add(object);
i++;
... |
4f4611f6-041a-4ad3-abc1-42110d199e11 | 8 | private TextBlock getCircledCharacter(ILeaf entity, ISkinParam skinParam) {
final Stereotype stereotype = entity.getStereotype();
if (stereotype != null && stereotype.getSprite() != null) {
return skinParam.getSprite(stereotype.getSprite()).asTextBlock(stereotype.getHtmlColor());
}
if (stereotype != null && ... |
15440c1c-bd89-49d6-8a14-69fb747d7f7a | 0 | private NamesManager()
{
} |
a5f32112-1e13-4045-bf8f-03ae99dd86da | 1 | public static void main(String[] args) {
for (int i = 0; i < 5; i++)
new Thread(new LiftOff()).start();
System.out.println("Waiting for LiftOff");
} |
dee188d7-9a48-48b7-a6f0-8ff4eaba6d9a | 2 | public void forceClose(){
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e){
e.printStackTrace();
try{
this.fileChannel.close();
this.fileOutputStream.close();
}catch(Exception e1){
e1.printStackTrace();
}
}finally{
this.file.delete();// 丢弃损害的文件... |
7f5779ca-440b-4693-a2a4-821a4e9cf02b | 5 | private void saveImage(){
if (this.jLabelImage.getIcon()!=null){
ImageProcessing.imageFormat extension;
switch(this.jComboBox1.getSelectedItem().toString()){
case "BMP":
extension= ImageProcessing.imageFormat.bmp;
break;
ca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.