method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
24ee9740-019f-4f0c-b7ca-2781db3b8183 | 7 | public void setCurrentItem(int par1, int par2, boolean par3, boolean par4)
{
boolean var5 = true;
int var7;
if (par3)
{
var7 = this.getInventorySlotContainItemAndDamage(par1, par2);
}
else
{
var7 = this.getInventorySlotContainItem(par1... |
e3016edc-3ab5-43cd-9807-430bad165d94 | 2 | @Override
public void mouseWheelMoved(int change){
selectedInv += change / 120;
if(selectedInv > player.playerInv.inv.length - 1) selectedInv = 0;
if(selectedInv < 0) selectedInv = player.playerInv.inv.length -1;
} |
7caf6236-6c8e-4d4d-8e6d-b3e9c8e10548 | 9 | public String classifyIt(String word) {
int n = word.length();
char c[] = new char[n];
char cf[] = new char[n];
c = word.toCharArray();
int ans = 0;
for(int i = 0;i < n;i++){
if(c[i] != c[n - i - 1]){
ans = 1;
}
}
if(ans == 0)return "PALINDROME";
int ans1 = 0;
int k = 0;
for(int i = 0;i ... |
4d1ff543-9f86-471d-bd1c-eaa087704ab4 | 0 | public ProBotGame() {
//For JFrame
super("ProBot");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
this.upgradeManager = new UpgradeManager();
this.menuManager = new MenuManager(this);
this.gui = new Gui(this);
this.canvas = new GameCanvas(this);
add(this.canvas, BorderLayout.C... |
998d6d6a-4f89-4f24-b213-ec6200cc11f9 | 9 | public void readParams() throws IOException {
Set<String> allParams = paramsSet();
// Read normal non-multipart params.
Map<String, String> parentParams = mParent.getParams();
for (String name : allParams) {
if (!parentParams.containsKey(name)) {
... |
60d26ea3-cb1a-46c9-8d68-5f14a6bcd96b | 1 | public ScreenShotsManager(String videoFileName)
{
filePrefix = videoFileName.substring(0, videoFileName.indexOf("."));
File outputDir = new File(outputDirectory);
if (!outputDir.exists())
outputDir.mkdirs();
} |
00f4404b-74da-4422-ab08-8074ec9dc8d6 | 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... |
f3c02f61-5cf7-4eb5-8285-652044e009bf | 9 | public static void createAccessorUnitsForSlot(StorageSlot slot, Stella_Class renamed_Class, boolean mixinaccessorsP, boolean signaturesonlyP) {
{ Cons methodtree = null;
MethodSlot method = null;
if (StorageSlot.systemDefinedSlotReaderP(slot)) {
methodtree = StorageSlot.yieldSlotReaderTree(slot... |
588cec86-c9cf-43fd-bb1d-e5a3c129204c | 0 | public final String getFinger() {
return _finger;
} |
ab630b1e-2fd2-4fca-9f93-74f04d694c0a | 3 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
//draw points
for (Point p : points) {
g.drawRect(p.x, p.y, 1, 1);
}
//draw rectangle
if (rectangle != null) {
for (int i = 0; i < 4; i++) {
Point p1 = rectangle[i];
Point p2 = rect... |
a41834d3-9db0-45a8-9adc-303824fd46c0 | 6 | static String ReadLn(int maxLength)
{
// utility function to read from stdin,
// Provided by Programming-challenges, edit for style only
byte line[] = new byte[maxLength];
int length = 0;
int input = -1;
try
{
while (length < maxLength)
... |
ba5a3cf9-08e4-40a1-b011-20da6ee1628a | 0 | public String toString() {
return super.toString();
} |
529366b5-88b5-4fcf-a9c7-22181daf61fc | 1 | public RefereeProgram()
{
// initialise the number of elements in the referee class array
elementsInArray = 0;
// initialise the referee class array with null values
refereeClassArray = new RefereeClass[MAX_REFEREES];
for (int i = 0; i < MAX_REFEREES; i++)
refereeClassArray[i] = null;
} |
ab87b14f-0d0d-4335-ad61-4f3ce1a968a7 | 4 | private void renderBubble(
Rendering rendering, Bubble bubble,
Vec3D flatPoint, boolean fromRight
) {
//
// Some of this could be moved to the constants section-
final float
x = flatPoint.x + bubble.xoff,
y = flatPoint.y + bubble.yoff,
//TW = BUBBLE_TEX.xdim(),
//TH = BUBB... |
2c1b228a-74af-411b-bc69-cadaa6dcbeb8 | 1 | private void appendStmt(final Stmt stmt) {
if (Tree.DEBUG) {
System.out.println(" append: " + stmt);
}
stmt.setParent(this);
stmts.add(stmt);
} |
812cb75d-2902-48ff-8c32-3a6105a2f35a | 7 | private static void printPartialFieldMap(Field[][] pMap)
{
System.err.println("pMap");
for (int y=0; y<pMap[0].length; y++) {
for (int x=0; x<pMap.length; x++) {
if (pMap[x][y] != null) {
Object o = pMap[x][y].object;
if (x==2 && y==2) System.err.print(" a");
if (o instanceof Box) System.err... |
6e657a01-5277-49d1-b427-892af9f54125 | 0 | @Test
@Ignore // not supported yet in FlowDroid
public void runTestStaticInitialization1() throws IOException {
InfoflowResults res = analyzeAPKFile("GeneralJava_StaticInitialization1.apk");
Assert.assertEquals(1, res.size());
} |
33d8cf5e-c17a-4c12-894b-56c5553d1492 | 7 | public static void printPascalTriangle(int n) {
int[][] grid = new int[n][n];
// first loop for number of rows
for( int i=0; i< grid.length; i++) {
//second loop for number of elements
for( int j = 0; j < i+1; j++) {
// i-1 and j-1 are greater or equals to... |
559085ad-0095-453c-8d32-d8e40b365bd6 | 7 | public static void extractPlaces(JSONObject root, ArrayList<Bookmark> bookmarksList) {
if (root.get("type").equals("text/x-moz-place-container")) {
// recursion
JSONArray rootChildren = (JSONArray) root.get("children");
if (rootChildren != null) {
for (Object child : rootChildren) {
extractPlaces((J... |
d5cc1689-92b4-4115-9352-fc24c3bcdd33 | 4 | public void playTurn(Player p, int diceThrow) {
Cell currCell = this.getCell(p.getCurrentCell());
if(currCell.canBeLeftNow()){
int idxNextCell;
// Makes the score stay within the bounds
System.out.print(p.getName()+" throws a "+diceThrow+"");
if(p.getCurrentCell()+diceThrow==63){
System.err.println(... |
b6011ede-aa6c-4147-b8ad-f613921a4041 | 7 | void radf4(final int ido, final int l1, final double in[], final int in_off, final double out[], final int out_off, final int offset) {
final double hsqt2 = 0.707106781186547572737310929369414225;
int i, ic;
double ci2, ci3, ci4, cr2, cr3, cr4, ti1, ti2, ti3, ti4, tr1, tr2, tr3, tr4, w1r, w1i, w... |
040d0a24-fc26-4918-951e-ad07982d51d0 | 5 | public InteractiveObject getInteractiveObject(int x, int y, int z) {
Ground tile = groundArray[z][x][y];
if (tile == null)
return null;
for (int e = 0; e < tile.entityCount; e++) {
InteractiveObject entity = tile.interactiveObjects[e];
if ((entity.uid >> 29 & 3) == 2 && entity.tileLeft == x
&& entit... |
934a38c4-da06-49fd-b746-5095295512d1 | 9 | public static Func getCallableSingleFunctions(Object obj, String funcStr) {
if (StringUtils.isEmpty(funcStr) || StringUtils.isBlank(funcStr)) {
return null;
}
int PRE_ARGS_NUM = -1;
Class<?>[] PRE_ARGS_TYPE = null;
try {
PRE_ARGS_NUM = obj.getClass().getD... |
62fb0a20-32d6-42af-844e-2a2f128ce954 | 2 | protected void majVoieSuivante(Voie voie) {
if (route == null) {
route = new Route(voie);
setChanged();
notifyObservers(route);
}
else if (route.setTo(voie)) {
setChanged();
notifyObservers(route);
}
voieCourante = voie;
} |
92b02da5-52bd-4c12-b0bd-761957abb148 | 6 | public void setSelectionObjects() {
getCurrentGraph().deselectAll();
for (Vertex vertex : selectionVertexes) {
vertex.selectOn();
}
for (Edge edge : selectionEdges) {
edge.selectOn();
}
for (Vertex vertex : getCurrentGraph().getVertexes()) {
if (vertex.isVertexInArea(pointSelectionBegin, pointSelec... |
4296c4a3-0473-4f57-8aea-0905df70bcb5 | 4 | @Override
public boolean equals(Object o)
{
if (this == o) return true;
if (!(o instanceof NotFilter)) return false;
NotFilter notFilter = (NotFilter) o;
if (filter != null ? !filter.equals(notFilter.filter) : notFilter.filter != null) return false;
return true;
} |
5575e647-84fa-4976-9f4a-2021c1ede8f2 | 9 | public void keyReleased(KeyEvent e)
{
switch (e.getKeyCode())
{
case KeyEvent.VK_C:
gui.switchTool(new ChainPolygon(vertices, gui));
break;
case KeyEvent.VK_F:
gui.switchTool(new FreeDraw(vertices, gui));
break;
... |
46548c61-f138-41a5-a575-26c19c021edc | 8 | public void passRightMouseClick(float mouseX, float mouseY)
{
ArrayList<GameEntity> s = main.menuSystem.stack;
if (s.size() > 0)
{
//System.out.println(s.size());
Tile t = main.menuSystem.getMouseHighlighted();
if (t != null)
{
if (main.grid.hasEnemy(s.get(0), t.row, t.col) != null)
{
i... |
0f871628-f2f0-477c-81ba-f456c88c0d77 | 6 | public void processGroups()
{
groups = new ArrayList<GroupAi>();
for (Square[] c : squares)
{
for (Square s : c)
{
if (s.piece != null)
{
boolean inGroup = false;
for (GroupAi g : groups)
{
if (g.pieces.contains(s.piece))
{
inGroup = true;
break;
}
... |
aa71ac57-d3ac-4232-88b5-eec878730d8a | 4 | private Action nextSomaOrderFor(Actor actor) {
if (stocks.amountOf(SOMA) <= 0) return null ;
if (actor.traits.traitLevel(SOMA_HAZE) > 0) return null ;
final float price = priceFor(SOMA) / 10f ;
if ((price > actor.gear.credits() / 2) || ! isManned()) return null ;
final Action drops = new Action... |
0626ea51-36e7-4167-8e4b-13fc1b7cba77 | 4 | public static Color getColor(String name) {
if (name == null)
return null;
if (name.charAt(0) == '#') // hex encoding
return Color.decode(name);
for (ColorNameMap col : map) {
if (name.equalsIgnoreCase(col.colorName))
return col.jColor;
}
return null;
} |
bc3dbbad-ecc8-4d1d-9053-c2f829becbff | 7 | public int bonusUnite() {
int count = 0;
List<Peuple> lstTmp;
for (Territoire t : this.territoiresOccupes) {
boolean vide = true;
for (int i = 0; i < Partie.getInstance().getTourEnCours(); i++) {
lstTmp = t.getPrisesDuTerritoire(i);
if (lstTmp.size() > 0) {
if (! lstTm... |
77d6a7d2-33c8-48d5-98db-63e6599addf1 | 7 | void drawEntity(Entity entStore)
{
double x = entStore.intLocX-LocX+viewRange;
double y = entStore.intLocY-LocY+viewRange;
//Draw flag
if (entStore.intFlag != 0)
{
if (entStore.intFlag == 1)
{
gD.setColor(Color.green);
gD.drawRoundRect((int)(x*intImageSize),(int)(y*intImageSize),
intImag... |
e36af224-a338-4afb-a964-9c3ccd3e95ec | 7 | public String [] getOptions() {
String [] options = new String [10];
int current = 0;
if (m_noCleanup) {
options[current++] = "-L";
}
if (m_unpruned) {
options[current++] = "-U";
} else {
if (!m_subtreeRaising) {
options[current++] = "-S";
}
options[current++] = ... |
8fe9fb3e-4c00-4cb1-8f8b-7eb235bddb35 | 1 | public static void hit(int x, int y)
{
System.out.println("AI - hit!");
if(!destroyingFoundShip)
{
System.out.println("AI - found a ship!");
destroyingFoundShip = true;
lastNewShip = new Point(x, y);
}
hitLocs.add(new Point(x , y));
} |
f68c79e1-ecb6-43d6-aff9-d0698c7bfa39 | 4 | public Tile getTile(int x, int y) {
if(0 > x||x>=width||0 > y||y>=height){return Tile.VOID;}
return Tile.tiles[tiles[x+y*width]];
} |
4c563eb4-df4f-41b5-bffb-4cb112792b7e | 1 | private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
JFileChooser chooser = new JFileChooser("/");
int returnVal = chooser.showOpenDialog(this);
if(returnVal == JFileChooser.APPROVE_OPTION) {
jTextField8 .setText(chooser.getS... |
f182df39-087a-41f1-a845-464d20dc7523 | 1 | public Term substitute(Term term, Term replacement) {
// The only thing that you can substitute in a predicate is an argument,
// so we just have to iterate over all arguments and propagate the
// substitution request.
List<Term> substitutedArgs = new ArrayList<Term>(args.size());
... |
58d5d9f3-1887-4f00-822f-5e427ca49019 | 6 | private IMOperation getImOperation() {
IMOperation imOp = new IMOperation();
imOp.addImage("-");
if (iMagickSettings.isUnsharpMaskEnabled()) {
double radius = iMagickSettings.getUnsharpMaskRadius();
double sigma = Math.sqrt(radius);
imOp.unsharp(radius, sigma,... |
a442fbe6-6e90-490b-9bd2-9f3fc09c1899 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
PointWithHamma that = (PointWithHamma) o;
if (Double.compare(that.hamma, hamma) != 0) return false;
... |
e232c0b3-1875-4222-88a7-05d0047ce542 | 1 | public static void rebuildSessionFactory() {
try {
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
} |
ee24adcb-b00b-44bc-ac61-052837a55f0a | 6 | public Object getValueAt(int row, int column) {
if ((row < getRowCount()) && (column < getColumnCount())
&& (row >= 0) && (column >= 0)) {
switch (column) {
case StatisticsModel.NAME_COLUMN:
return data[NAME_COLUMN][row];
ca... |
0467938e-cde3-4868-9a83-2ea0d159344c | 2 | public Karte ziehKarte()
{
Karte k = deck.remove(0);
if(!enableNine && k.getTyp() == Typ.Neun)
{
return ziehKarte();
}
return k;
} |
0aa04b65-223d-4274-a3a5-74f0893a5a07 | 3 | public static String stringCheck (String input, HashSet<String> dictionary){
// This method makes sure user input is four letters, is in the dictionary HashSet, and is lower case, and informs user of specific errors
boolean error = false;
if (input.length() != 4){
System.out.println("Error: Your word is not f... |
a30d7ea5-85e4-4c64-b281-1f5ff0418aa3 | 2 | private static void write() {
try {
File file = new File(SavePath.getSettingsPath());
if (!file.exists()) {
file.createNewFile();
}
FileWriter fileWriter = new FileWriter(file.getAbsoluteFile());
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter... |
2a1af06a-7048-48a7-9031-b3191e75c45c | 6 | public void apply() {
if(!applied) {
applied = true;
prevPosition = model.positions.get(actor);
nextPosition = prevPosition;
Vector2 velocity = actor.velocity;
if(actor instanceof Collidable) {
SortedMap<Double, Collidable> intersections = Collision.collision(model, (Collidable)actor, velocity);
... |
428f96ec-df5e-49f8-a16a-481ea657a144 | 4 | boolean validTreeLocation() {
int[] var1 = new int[]{this.basePos[0], this.basePos[1], this.basePos[2]};
int[] var2 = new int[]{this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
int var3 = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);
i... |
ba906644-8fbc-4496-ac89-e4d1109c3beb | 3 | public Texture getErrorTexture() {
Texture tex = (Texture) table.get("Error");
if (tex != null) {
return tex;
}
try {
tex = org.newdawn.slick.opengl.TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(System.getProperty("resources") + "/sprites/Error.png"));
} ... |
70a3e4fb-64bd-465f-9023-a916a86e5ecd | 4 | public void updateImage() {
if (facing == 0) {
toggleImage(4);
}
if (facing == 1) {
toggleImage(1);
}
if (facing == 2) {
toggleImage(3);
}
if (facing == 3) {
toggleImage(2);
}
} |
ccf39efa-65aa-4286-9497-8e746fc53bd5 | 6 | public static ArrayList getRepresentativeTags(Map imagesTags, int percentage) {
ArrayList representativeTags = new ArrayList<String>();
/*
1. Create Map "alltags" tag => count (0)
2. Count all occurrences and add to tag pool
3. Choose "int count" REFERENCE_TAG_PERCE... |
5e012b07-c3c4-4626-bc97-1c225aaaf8b1 | 0 | public void addVictim(Animal animal) {
victims.add(animal);
} |
9416d4e6-dfe7-4dc0-9eb1-09201efe63ce | 5 | public void paint(Graphics g) {
super.paintComponent(g);
g.setColor(Color.white);
g.fillRect(0, 0, 3000, 2000);
g.setColor(Color.black);
g.drawString("Play Speed: "+playSpeed, box.resolution().width-120, box.resolution().height-100);
long currentTime = System.currentTimeMillis();
if (currentTime > nextS... |
be9ce80b-92c2-4abd-8bb6-d9c0a6a4bb7d | 9 | public void initialize() throws Exception {
int numOfAttributes;
int numOfInstances;
int i;
int j;
Change = 0.0;
//Manipulate Data
if (NormalizeData) {
m_Filter = new Normalize();
m_Filter.setInputFormat(m_Instances);
m_Instances = Filter.useFilter(m_Instances, m_Filter);... |
e038c456-cea8-498c-9039-91160b2f09f9 | 2 | @Override
public List<Produto> findProdutosRelacionados(Long idProduto) {
Produto produto = findById(idProduto);
List<Categoria> categorias = produto.getCategorias();
Set<Long> idsCategorias = new HashSet<>();
for (Categoria categoria : categorias) {
idsCategorias.add(categoria.getId());
}
List<Pr... |
7143f7fe-20d5-40cc-92d1-d813522c0fad | 1 | private void initComponents()
{
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e)
{
System.out.println("Unable to set LookAndFeel...");
}
timer = new Timer(1000, taskPerformer);
setLayout(... |
d351298d-9ece-4945-b6e3-7411cdc4a0b3 | 2 | private void addOccupant(T occupant) {
Class cl = occupant.getClass();
do {
if ((cl.getModifiers() & Modifier.ABSTRACT) == 0)
occupantClasses.add(cl);
cl = cl.getSuperclass();
} while (cl != Object.class);
} |
461b1432-1b4d-4cfe-be1c-dd7b830bce46 | 5 | @Override
public V put(K key, V value) {
// Check and call rehash() if needed:
if(this.size() > 0.75 * capacity) {
rehash();
}
V oldValue = null;
int index = Math.abs(key.hashCode()) % SIZE;
if(buckets[index] == null) {
buckets[index] = new L... |
e97a9d95-1dcd-47b8-bd84-87d3a7aac2f5 | 3 | public void init() {
int index = 0;
for (int r = 0; r < 6; r++) {
for (int g = 0; g < 6; g++) {
for (int b = 0; b < 6; b++) {
int rr = (r * 255 / 5);
int gg = (g * 255 / 5);
int bb = (b * 255 / 5);
colours[index++] = rr << 16 | gg << 8 | bb;
}
}
}
screen = new Screen(WIDTH, HEI... |
03fc5fe7-53b6-469d-adc2-92c0dbb8e792 | 4 | private void bLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bLoadActionPerformed
JFileChooser jfc = new JFileChooser();
if (lastLoadDir != null) {
jfc.setCurrentDirectory(lastLoadDir);
}
jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (j... |
63ec0285-7688-450f-9635-bb330c7f43c2 | 1 | public void visit_irem(final Instruction inst) {
stackHeight -= 2;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
stackHeight += 1;
} |
21d8033c-d59c-4f0c-ba67-fc3cc8a93af6 | 1 | public Integer getDistanceToStart() {
if (river == null)
return 0;
return river.getDistanceToStart();
} |
a869b1f2-f5cf-4fc6-8ab2-b830e6b53341 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2001/04/xmlenc#", name = "KeySize", scope = EncryptionMethodType.class)
public JAXBElement<BigInteger> createEncryptionMethodTypeKeySize(BigInteger value) {
return new JAXBElement<BigInteger>(_EncryptionMethodTypeKeySize_QNAME, BigInteger.class, EncryptionMetho... |
6c9f962e-57b3-4d0f-943f-94db392eb4a5 | 5 | public int countAll(){
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
dbCon.getDB_U... |
74c54129-8452-4a90-99d9-b72ca2f58808 | 3 | public void run() {
running = true;
final int CHAT_PORT = 4712;
try {
ServerSocket chatServerSocket = new ServerSocket(CHAT_PORT);
ServerDataBaseManager sDBM = new ServerDataBaseManager();
while (true) {
if (running) {
new ChatServerExecutionThread(chatServerSocket.accept(), sDBM).start();
}... |
d504cf4e-fa35-4544-bda6-110cb1617ca3 | 3 | public float ms_per_frame() // E.B
{
if (h_vbr == true)
{
double tpf = h_vbr_time_per_frame[layer()] / frequency();
if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF)) tpf /= 2;
return ((float) (tpf * 1000));
}
else
{
float ms_per_frame_array[][] = {{8.707483f, 8.0f, 12.0f},
... |
f54eee3f-d761-46cf-918b-5b49aae403e7 | 5 | private void outputAndCompare(String line) throws ControllerException {
output.println(line);
output.flush();
if (gui != null) {
gui.outputFileUpdated();
gui.setCurrentOutputLine(outputLinesCounter);
}
outputLinesCounter++;
if (comparisonFile !=... |
8939afc6-3d57-4b01-8319-aebadb6c4726 | 7 | private void afterDataAccess(CacheResult cacheResult, Object[] args) throws CacheUnreachableException {
CacheDefinition cacheDefinition = cacheDefinitionCollection.getCacheDefinition();
// 如果不是缓存获取操作,则只需要进行简单的缓存删除和版本信息更新
if (cacheDefinition == null) {
updateVersion(args);
deleteCache(args);
return;
}
... |
51ac2dea-80b8-4478-bd87-c3e57329465a | 8 | public static Graph tree(int V) {
Graph G = new Graph(V);
// special case
if (V == 1)
return G;
// Cayley's theorem: there are V^(V-2) labeled trees on V vertices
// Prufer sequence: sequence of V-2 values between 0 and V-1
// Prufer's proof of Cayley's theorem: Prufer sequences are in 1-1
// with la... |
564b7201-33e3-46df-8bfd-c85fc0e75755 | 1 | public Shape clone() {
Shape clone = null;
try {
clone = (Shape) super.clone();
} catch (CloneNotSupportedException exception) {
System.out.println("Exception :" + exception);
exception.printStackTrace();
}
return clone;
} |
23de60b5-cfc7-49a9-84ac-b57d2b8f625b | 2 | private int executeRandomMusics() {
int countMusics = 0;
int index = 0;
while(countMusics != getMusics().size()){
index = getAleatoryNumber(index);
getMusics().get(index).play();
if(!isRamdom) break;
}
return index;
} |
500b7f18-f621-4629-b2ae-06c7fb6f1cc1 | 8 | static void gwar_draw_sprites_16x16(osd_bitmap bitmap, int xscroll, int yscroll ){
GfxElement gfx = Machine.gfx[GFX_SPRITES];
//const unsigned char *source = &memory_region(REGION_CPU1)[0xe800];
UBytePtr source = new UBytePtr(memory_region(REGION_CPU1),0xe800);
... |
069bfb18-b455-4dbc-813b-929fe5b150e3 | 9 | @Override
protected void mutate(Individual indiv) {
Sudoku sudoku = (Sudoku)indiv;
Random r = new Random();
for(int i=0; i<numOfTries; i++){
//choose a row
int row = r.nextInt(9);
//choose a begin point of cut
int cut1 = r.nextInt(9);
//choose a end point of cut
int cut2 = r.nextInt(9);
... |
8ba094f8-362a-4bf0-906b-9e762ff98d3f | 2 | public void pruneAllNodeEvents() {
EventQueue eq = new EventQueue();
eq.listeners = this.listeners; // inherit the listeners
Iterator<Event> eventIter = iterator();
while(eventIter.hasNext()){
Event e = eventIter.next();
if(e.isNodeEvent()) {
e.free(); // also frees a corresponding packet event, incl... |
7e0c7771-0af4-4e15-b8cf-2a1aff92be41 | 6 | public static void main(String[] args) throws IOException {
if (args.length == 0 || args[0].equals("help")) {
System.out.println("\n \tSNP-SVM v. 0.02");
System.out.println("\tBrendan O'Fallon, ARUP Labs, Salt Lake City, Utah");
System.out.println("\tbrendan.d.ofallon@aruplab.com");
System.out.pr... |
283c87a0-0897-4534-b755-dc72768a49f6 | 8 | public static Op GOT(Op newOp) {
int k = 0, j = 0;
StateVector vecNew = newOp.getStateVec();
for (k = 0; k < hBuffer.size(); k++) {
Op opTmp = hBuffer.get(k);
StateVector vecTmp = opTmp.getStateVec();
// a, b are independent
if (!isDependent(vecTmp... |
9f06fd10-12ff-4cde-945c-ba123046f80c | 3 | public ExprInfo(final Expr expr, final ExprKey key) {
this.key = key;
prototype = (Expr) expr.clone();
// Clean up the expression's children (remember that expr's children
// are also cloned, so we aren't changing the tree).
prototype.visitChildren(new TreeVisitor() {
public void visitStoreExpr(fin... |
6347cfbf-de1a-47d4-bb14-d21d0e710f8a | 4 | private int[] getCampusDistributionData() {
CourseList model = super.getModel();
campusDistribution.clear();
CourseOffering[] offerings = model.getSelectedCoursesOfferings();
String campus = null;
for(int i = 0; i < offerings.length; i++) {
campus = offerings[i].getLocation().toUpperCase();
if(campus.eq... |
510807b3-ddd5-42a8-a071-f4a6bd42eab0 | 6 | @EventHandler
public void PlayerResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getPlayerConfig().getDouble("Player.Resi... |
8fa9eb6b-703c-4fb6-b921-fd12b9b3b946 | 3 | public int getSetDamage(String type)
{
if(type.equals("face"))
{
return FACE_DAMAGE;
}
else if(type.equals("slash"))
{
return SLASH_DAMAGE;
}
else if(type.equals("gutpunch"))
{
return GUTPUNCH_DAMAGE;
}
return 0;
} |
442e9499-995e-42a3-b882-aa2df4470632 | 6 | public Set<Map.Entry<K,Byte>> entrySet() {
return new AbstractSet<Map.Entry<K,Byte>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TObjectByteMapDecorator.this.isEmpty();
}
public bool... |
27a3b976-4a8a-400c-adbe-205240a62e00 | 9 | private void generateClassroom()
{
ArrayList<Point> doors;
if (day.getNextCourse().ordinal() == 0) // first class (could hardcode as HUMANITIES)
{
playerX = playerY = 5;
screenX = screenY = 0;
destination = null;
doors = campus.getDoors(true);
for (int i=0; i<TILESX; i++)
{ for (int j=0... |
c7e3c2e8-2c97-46ce-8c48-c4b8750dfeb0 | 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... |
595d2427-af2e-4832-a087-0314f9eac07e | 8 | private void txtSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtSearchActionPerformed
DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
model.getDataVector().removeAllElements();
tableIndex=0;
model.fireTableDataChanged();
int key... |
9faf85d5-a5a4-45d8-a996-cee70bd038b8 | 6 | public static void warpSign(Player player, Warp to) {
if (Settings.delay == 0 || (Settings.opsBypassDelay && player.isOp()) || (Settings.permsBypassDelay && player.hasPermission("easywarp.delay.bypass")) || (Settings.signsBypassDelay)) {
warp(player, to);
return;
}
dela... |
0422b9bb-9861-4d26-8f6e-916020753523 | 1 | @Override
protected void paintComponent(Graphics graphics) {
super.paintComponent(graphics);
for (Piirrettava piirrettava : piirrettavat){
piirrettava.piirra(graphics);
}
} |
d2bb0174-381f-42c1-b0be-41b8ccf8cfea | 1 | protected Integer calcBPB_SecPerClus() throws UnsupportedEncodingException {
byte[] bTemp = new byte[1];
for (int i = 13;i < 14; i++) {
bTemp[i-13] = imageBytes[i];
}
BPB_SecPerClus = byteArrayToInt(bTemp);
System.out.println("BPB_SecPerClus = " + BPB_SecPerClus);
... |
c4884ef8-b7bf-4719-9c6b-b3fd7fd10782 | 3 | public AnimationPoints(int directions, int frames, String points) {
this.points = new Point2D[directions][frames];
ArrayList<Point2D> temp = new ArrayList<Point2D>();
String[] line = points.split(";");
for(int x = 0; x<line.length; x++) {
String[] tempPoint = line[x].split(",");
temp.add(new Point2D.Fl... |
40005766-5baa-4896-9c2b-4dd99853ffef | 6 | public void run(){
while (true){
for (int i = 0; i<anzahlAmpeln; i++){
int x=(Math.random()<0.5)?0:1;
//System.out.println("random x=" +x);
if (x==0){
ampeln[i].setRed();
System.out.println("Ampel #" +i+" auf rot gesetzt.");
try {
sleep(100);
} catch (InterruptedExcept... |
32bf7993-db72-4626-8891-20e2a43b7059 | 0 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
// TODO Auto-generated method stub
} |
527fec0d-de99-40f6-9bdd-c4320f4f8f3b | 7 | private static Set<Class<?>> getFromJARFile(String jar, String packageName) throws FileNotFoundException, IOException, ClassNotFoundException {
Set<Class<?>> classes = new HashSet<Class<?>>();
JarInputStream jarFile = new JarInputStream(new FileInputStream(jar));
JarEntry jarEntry;
do {
... |
7f989407-ad5b-4db6-8ed5-7bfa0f0f2bdc | 9 | static void AgentsCreation(){
/* Initialises all teams, agents and weapons. Currently initialises agents by input
* and weapons by hand. To do: initialise create more weapons, add random initialisation, etc
* also add checks for all the input getting
*/
Gun pistol = new Gun("Pistol", 3, 70, 2);
Gun h... |
46d190e5-3f38-4ef4-8c09-cf8de5ed1106 | 5 | public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (!plugin.hasPerm(sender, "user", true)) {
sender.sendMessage(ChatColor.YELLOW
+ "You do not have permission to use /" + label);
return true;
}
if ((args.length == 3) && (args[1].equalsIgnoreCase("ren... |
76e18979-8150-4773-bf26-82ae0d211fd4 | 1 | public void testConstructor_ObjectStringEx6() throws Throwable {
try {
new LocalDateTime("10:20:30.040+14:00");
fail();
} catch (IllegalArgumentException ex) {}
} |
1830d111-ecb6-491c-983d-8a4aa50a5343 | 1 | public String[] toDTO(Ticket ticket) throws ParseException {
String[] dto = new String[8];
try {
String place = new PlaceTranslator().toDTO(ticket.getPlace());
String row = new RowTranslator().toDTO(ticket.getPlace().getRow());
String seance = new SeanceTranslator().toDTO(ticket.getSeance());... |
822d2ee1-071b-4a7a-a79d-d727346a9731 | 8 | public static Object escape(Object original) {
if (original instanceof Character) {
char u = (char) ((Character)original);
int idx = "\b\t\n\f\r\"\'\\".indexOf(u);
if (idx >= 0)
return "\\"+"btnfr\"\'\\".charAt(idx);
if (u < 32)
re... |
8f15acb8-66db-4de5-9cba-386d913b2f27 | 0 | public Person2(String pname) {
name = pname;
} |
269b2294-94ea-410a-829f-b7ebfa0098c9 | 1 | public boolean isEmpty() {
return (id == null) && (name == null);
} |
dad43951-6694-48a9-910d-5479c89a0f2a | 4 | private void ok()
{
mcdobject.clearInformations();
for (int i = 0; i < listDroite.getSize(); i++) {
data.setUse(listDroite.getKey(i), true);
mcdobject.addInformation(listDroite.getKey(i));
}
// Vérifie que le nom n'est pas utilisé par quelqu'un d'autre
... |
fd7d083b-dedc-49ab-923f-b6240fd28cb5 | 8 | public void ustalKtoWygral()
{
iloscTrafionychGRACZ = 0;
iloscTrafionychPRZECIWNIK = 0;
JLabel ikonaTrafionePole2 = new JLabel(img_trafionePole2);
for(int a = 0;a < 10; a++)
for(int b = 0;b < 10; b++)
{
if(lb_polaGry_GRACZ[b][a].getIcon().toString().equals(ikonaTrafionePole2.getIcon().toStr... |
b85326d5-5201-4c88-9dee-e04bf2f35409 | 8 | public boolean checkRomanNr(String romanNumber) {
float[] substractOperations = new float[9];
char currentLetter = romanNumber.charAt(0);
if (romanNumber.length() > 1) {
char nextLeter = romanNumber.charAt(1);
float globalMax;
if (getValue(currentLetter) < g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.