method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
f023b5bd-02e1-43ae-b1b2-7751e4ee70bb | 1 | public List<Integer> preorderTraversal(TreeNode root){
List<Integer> list = new ArrayList<Integer>();
if(root == null) return list;
preOrderRec(list, root);
return list;
} |
75519e22-924b-4f66-a33f-7dc401b45017 | 3 | public FileInputStream nextElement() {
if(next != null){
try {
next.close();
} catch (IOException e) {
e.printStackTrace();
}
}
try {
FileInputStream in = new FileInputStream(streamList[index]);
index++;
return in;
} catch (FileNotFoundException e) {
e.printStackTrace();
}
//Imp... |
b1505705-ee85-4342-8bcd-57149441ddf5 | 9 | public ConstantVolumeJoint(World argWorld, ConstantVolumeJointDef def) {
super(argWorld.getPool(), def);
world = argWorld;
if (def.bodies.size() <= 2) {
throw new IllegalArgumentException(
"You cannot create a constant volume joint with less than three bodies.");
}
bodies = def.bodie... |
79406218-ae34-4b82-a42b-fd3ff4c99ece | 3 | private static Fonttype getFonttype(String s) {
Fonttype ret = null;
if ((s != null) && !s.equals("")) {
try {
ret = Fonttype.valueOf(s.trim().toUpperCase());
} catch (IllegalArgumentException e) {
ret = null;
}
}
retu... |
c58ec74f-5d43-4c3b-8d96-c5524aba7ede | 3 | public String noteInfo(String what){
if(!System.getProperty("user.home").equals("C:/Users/fireblade") //Don't record stats if im... me, So much testing, so much falseness.
&& McLauncher.tglbtnSendAnonData.isSelected()){ //An option to let players send usage data anonymously.
URL url = null;
String we... |
3b0372b6-1978-4aed-a0a6-7ff5fcce0a94 | 3 | private Object getRussianRedoName(String redoPresentationName) {
if (redoPresentationName.contains("deletion")) return "Вернуть удаление";
if (redoPresentationName.contains("style")) return "Вернуть";
if (redoPresentationName.contains("addition")) return "Вернуть ввод";
return redoPresentationName;
} |
a0cddd12-1312-40e2-bf40-69cf6a85278d | 8 | public static void startupConses() {
if (Stella.currentStartupTimePhaseP(0)) {
if (!(Stella.NIL != null)) {
Stella.NIL = new Cons();
Stella.NIL.value = null;
Stella.NIL.rest = Stella.NIL;
}
}
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = ... |
4c7dcb98-8dfa-4fb5-9740-727eda6a8fc8 | 1 | private void literal()
{
if (accept(NonTerminal.LITERAL))
{
}
} |
5fe618e3-1782-45ee-8860-9f861f596429 | 8 | public void Launch() {
try {
String OS = System.getProperty("os.name").toUpperCase();
if(OS.contains("WIN")) {
AppDataPath = System.getenv("APPDATA");
LauncherName = "\\." + LauncherName;
Slash = "\\";
} else if(OS.contains("MAC")) {
AppDataPath = System.getProperty("user.home") + "/Library/... |
a97608b0-c653-4ce8-b6dd-df9bbfc5b4fa | 5 | public CheckResultMessage checkDayofMonth2() {
int r1 = get(10, 2);
int c1 = get(11, 2);
date();
if (checkVersion(file).equals("2003")) {
try {
in = new FileInputStream(file);
hWorkbook = new HSSFWorkbook(in);
if (!(getValueString(r1 - 2, c1 + maxDay, 2).equals(maxDay
+ "日"))) {
return... |
176d07eb-2776-4126-b98c-4fa465632a2f | 3 | public static int getPlayerID(String playerName)
{
for(int i = 0; i < maxPlayers; i++)
{
if(playersCurrentlyOn[i] != null)
{
if(playersCurrentlyOn[i].equalsIgnoreCase(playerName)) return i;
}
}
return -1;
} |
228af6d4-9cc2-47d5-8eef-e0b7eb7b752f | 4 | @Override
public Collection<Class<?>> getAutoCompleteClasses() {
if(getDescriptor().getClassRestriction() != null) {
ArrayList<Class<?>> classRestriction = new ArrayList<Class<?>>(1);
classRestriction.add(getDescriptor().getClassRestriction());
return classRestriction;
}
return null;
} |
fa07d327-30b4-4c9f-97f3-e1d15b6ae265 | 7 | public static void copyFile(File sourceFile, File destFile) {
try {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel ... |
362e8e03-30e4-4854-975c-017cdba05199 | 9 | @Override
public void onPlayerInteract (PlayerInteractEvent event) {
if(event.isCancelled()) {
return;
}
long cooldown = 0;
Date currentDate = new Date();
Player player = event.getPlayer();
int weaponID = player.getItemInHand().... |
b9138124-8491-4976-bcc1-9487aa6e39d3 | 9 | @SuppressWarnings("deprecation")
public List<ComponentIn> search(Map<String, String> critieras) {
Session session = HibernateUtil.sessionFactory.getCurrentSession();
session.beginTransaction();
Criteria hibernateCriteria = session.createCriteria(ComponentIn.class);
Set<String> keySet = critieras.keySet();
fo... |
dabb5637-25fe-4245-8b61-195d225d844a | 4 | public void addMeetingtoCalendar(Meeting meeting, String starttime, String endtime, int day){
String selectedCell;
starttime = starttime.substring(11, 16);
endtime = endtime.substring(11, 16);
for(int row = 0; row < tablemodel.getRowCount(); row++){
selectedCell = (String) tablemodel.getValueAt(row, 0)... |
85ebd224-9cd1-42a3-87f6-69d43ba9b049 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Schedule schedule = (Schedule) o;
if (id != schedule.id) return false;
if (seqNumber != schedule.seqNumber) return false;
return true;... |
f2330b2f-29ff-46e8-b73f-8b5a9e556888 | 0 | public BuilderControlPanel(BuilderController controller) {
// super(new GridLayout(1,0));
this.controller = controller;
initView(this, controller);
} |
e049c9c8-5b89-4aa4-8084-56c17bcb7e47 | 1 | public void bytesRead(int bytesRead)
{
totalBytesRead = totalBytesRead + bytesRead;
updateUploadInfo("progress");
try
{
Thread.sleep(delay);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
} |
2e8d4999-d51a-4b3d-8b4f-192010fa34dc | 3 | private void rotate(boolean clockwise) {
clear();
shape.rotate(clockwise);
// lefts
while (currentX + shape.getMostWest() < 0) {
currentX++;
}
// right
while (currentX + shape.getMostEast() > width - 1) {
currentX--;
}
// down
while (currentY + shape.getMostSouth() > height - 1) {
currentY... |
08636a3e-8ebd-4835-821a-239dc754006a | 6 | private void censored(int row) {
if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.CENSORED)) {
return;
}
PaidDetail selectedRow = result == null ? null : result.get(row);
if (selectedRow != null) {
int result = JOptionPane.showConf... |
829ac1a0-5f92-421d-865d-e22b7eb60b9f | 4 | public DragAndDropClassObject findNearestClass(int x, int y){
DragAndDropClassObject c;
double minDist = Double.MAX_VALUE;
int minDistIndex = -1;
for(int i=0; i < components.size(); i++) {
c = (DragAndDropClassObject)(components.get(i));
if(c.distanceTo(x,y) < minDist) {
minDist = c.distanceTo(x,y);
... |
116113fa-8e69-47c3-be92-67407d48b141 | 5 | @Override
protected AIBundle doInBackground() throws Exception {
long startTime = System.currentTimeMillis(); //use this instead of a timer thread to know when to stop.
bundle = new AIBundle(operation);
switch(operation){
//Switching on what we want returned.
case OPERATION_MOVE:
bundle = getNextM... |
14884e50-ad1a-4d5e-b988-1a349738a34c | 9 | public static void method526(String s, Stream stream)
{
if(s.length() > 80)
s = s.substring(0, 80);
s = s.toLowerCase();
int i = -1;
for(int j = 0; j < s.length(); j++)
{
char c = s.charAt(j);
int k = 0;
for(int l = 0; l < validChars.length; l++)
{
if(c != validChars[l])
continue;
... |
88024c20-966f-4378-af9e-b1ec62bfe377 | 0 | public static final boolean StateIsCharState(int index)
{
return index < 7;
} |
e9d4a674-b30d-4c60-a606-93cd6c641ed2 | 4 | @EventHandler
public void onPlayerQuit(PlayerQuitEvent event){
Player player = event.getPlayer();
if(player.getWorld() == DeityNether.plugin.getServer().getWorld(DeityNether.config.getNetherWorldName()))
if(!player.hasPermission(DeityNether.OVERRIDE_PERMISSION) && player.hasPermission(DeityNether.GENERAL_PERMIS... |
add98a8c-40af-4d6a-b108-84b123ca6575 | 0 | @Override
protected void setColoredExes() {
// TODO Auto-generated method stub
ParametricCurve besie = new BesieCurve(allex);
coloredEx = besie.Calculation();
} |
f09dced4-055d-4149-a587-f4ee1da6d1ed | 6 | public Component getComponentFor(LodResource lodResource, TaskObserver taskObserver) throws InterruptedException
{
this.sourceLodResource = lodResource;
taskObserver.taskProgress(lodResource.getName(), 1f / (float)taskObserver.getRange());
JPanel panel = new JPanel(new BorderLayout... |
4c39f1ca-c13a-4283-bbf0-b92c742c3c41 | 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... |
b5ac4989-b724-491a-aa7f-4fd27bc5115c | 9 | @Override
public Object getMetaPacket(Object watcher) {
Class<?> DataWatcher = Util.getCraftClass("DataWatcher");
Class<?> PacketPlayOutEntityMetadata = Util.getCraftClass("PacketPlayOutEntityMetadata");
Object packet = null;
try {
packet = PacketPlayOutEntityMetadata.getConstructor(new Class<?>[] { int.c... |
3d2dd541-1d01-41ed-9c5b-803f6e20909d | 3 | private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
if(modCoche == null){
try{
taller.crearCoche(matText.getText(),marcaText.getText(),
modeloText.getText(),numKmText.getText(),
... |
35e36cc9-671a-43b5-9d14-275e1611e8af | 0 | public OSCJavaToByteArrayConverter() {
} |
9881b25d-819c-43f1-b780-94706f9dc79e | 2 | public static <T extends AppWindow> ArrayList<T> getActiveWindows(Class<T> windowClass) {
ArrayList<T> list = new ArrayList<>();
for (T window : new FilteredIterator<>(WINDOW_LIST, windowClass)) {
if (window.isShowing()) {
list.add(window);
}
}
return list;
} |
5dea023d-74e4-404f-91b1-caeb28df3b15 | 4 | public int adxrLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
if( optInTimePeriod > 1 )
return optInTimePeriod + adxLookback ( ... |
8a8535be-8fa2-4d56-9638-9fa2e18a801f | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
77ebd8bc-3c1d-4be0-b16c-6168480c1688 | 5 | private void fillTechnicals() {
int better = 0;
int worse = 0;
for (String s : dbSet)
TECHNICAL_PRICE_DATA.put(s, new TreeMap<Float, float[]>());
for (float[][][] tech : Database.DB_PRICES.values()) {
for (int id = 0; id < tech.length; id++) {
for (int i = 0; i < tech[id].length; i++) {
if (isDa... |
ba41a490-ac57-4c1a-8a9a-6ffaf1178cc3 | 6 | public static double Func(int i,int T){
double result1=Double.MAX_VALUE,result2=Double.MAX_VALUE;
if(i==n){return 0;}
if(c[i]!=-1) return c[i];
if(T==0){
double temp=0;
if(t[i] < (M-5)){
temp= Math.pow((M-5) - (t[i]), 4);
}
result1 = temp+Func(i+1,0);
}
if(T+t[i] <= M){
result2 = Fu... |
796a8814-e6a8-4628-bdf9-4f37f154eed1 | 8 | @Override
public void toCode(XDataOutput dataOutput) {
super.toCode(dataOutput);
switch(opcode){
case LOADB:
dataOutput.writeByte(((Number)_const).byteValue());
break;
case LOADS:
if(_const instanceof Character){
dataOutput.writeShort((Character)_const);
}else{
dataOutput.writeShort(((Numbe... |
64abb987-6394-40c4-9dba-794864f3cd69 | 9 | int test5() throws MiniDB_Exception{
int points = 0;
// IN_SOLUTION_START
MiniDB db = new MiniDB( "minidb.test5" );
BufMgr bm = db.getBufMgr();
int size = 8;
BPlusTree bpt = db.createNewBPlusTreeIndex( "table", "val", 8 );
int iters = 50;
MiniDB_Record insertedRecords[] = new MiniDB_Reco... |
ae6357de-c196-48a8-a56f-4d72d5e4e19b | 5 | public static int melyJatekosKovetkezik( int b, int jatekos, int mi )
{
logger.info("Kiválasztja mely játékos következik.");
if( b%2 == 1 )
{
logger.info("1 játékos következik");
jatekos = 1;
if( mi == 0 )
System.out.println( "Az első játékos rak bábút: " );
if( mi == 1 )
System.out.println( ... |
a07039cc-1ca3-4f39-bfb0-fad2bdc8dab2 | 9 | public static String basicInspect(Object object) {
if ((object instanceof Class) ||
(object instanceof Boolean) ||
(object instanceof Integer) ||
(object instanceof Double) ||
(object instanceof Float) ||
(object instanceof Byte) ||
(object instanceof Character)) {
return object.toS... |
1ba211ed-0c09-41a3-a765-62f1988dcd14 | 3 | public void setVar(PVar node)
{
if(this._var_ != null)
{
this._var_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
... |
94ac1534-8014-4d04-98e8-515a16baa68a | 8 | public void scan() {
SAMFileReader inputSAM = new SAMFileReader(inputSAMFile);
SAMFileWriter outputSAM = new SAMFileWriterFactory().makeBAMWriter(
inputSAM.getFileHeader(), true, outputSAMFile);
SAMFileWriter outputSAM2 = new SAMFileWriterFactory().makeBAMWriter(
inputSAM.getFileHeader(), true, outputSAMF... |
e5750c45-cd33-4736-8e5c-d26dc4ba2898 | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
Raster source = sources[0];
Rectangle srcRect = source.getBounds();
int formatTag = MediaLibAccessor.findCompatibleTag(sources,dest);
M... |
67b31b87-a106-43a7-afa4-47c80090fe15 | 7 | @Override
protected void writeChildren(XMLStreamWriter out)
throws XMLStreamException {
super.writeChildren(out);
if (scopes != null) {
for (Scope scope : scopes) {
scope.toXMLImpl(out);
}
}
if (allowedWorkers != null) {
fo... |
71258b27-f3cc-43fb-a108-d30c74deb4e0 | 8 | public static int[][][][] read3model(String path){
int[][][][] out = new int[3][aa][aa][windowsize];
try{
FileReader input = new FileReader(path);
BufferedReader br = new BufferedReader(input);
String line;
line = br.readLine();
if(line.startsWith("//")){
int dim = Integer.parseInt(line.substrin... |
ff58a62f-36d3-4e76-80b6-76e7d2eeaf12 | 1 | protected void paint(Graphics2D g2) {
// draw all creatures
for (IDrawable d : getDrawables()) {
// save transformation for each drawable
AffineTransform cT = g2.getTransform();
d.paint(g2);
// restore transformation
g2.setTransform(cT);
}
} |
e90a42f4-bc6e-4fe8-8cfe-1b6727b49ef0 | 0 | public double getLatitude() {
return latitude;
} |
bbb9c880-165e-484f-833b-d6d1ce4bc104 | 5 | public void run() {
String s;
try {
System.out.println(Server1.getCurrentTime() + "1::" +"Starting Status thread");
statusSocket = new ServerSocket(statusPort);
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
while (true) {
try {
statusAcceptSocket = s... |
3254c62f-7a6d-4662-926e-24cc8b4ef6d2 | 4 | @Override
public boolean equals(Object o){
if(this == o)
return true;
if(o == null)
return false;
if(!(o instanceof Carta))
return false;
final Carta other = (Carta) o;
return this.numero.equals(other.numero) && this.palo.equals(ot... |
0b22cd8c-8d74-49ce-857f-385d4fda98f8 | 9 | public static void main(String[] args)
{
// ## DEFINE VARIABLES SECTION ##
// define the driver to use
String driver = "org.apache.derby.jdbc.EmbeddedDriver";
// the database name
String dbName="jdbcDemoDB";
// define the Derby connection URL to use
String connectionURL = "jdbc:derby:" + dbName + ";create=true... |
fff2215b-5839-4e20-8ec8-86611e44d79f | 9 | public String getLecturaPrimitivaCSharp() {
if (nombre.equals("String")) {
return "Console.ReadLine()";
}
if (nombre.equals("int")) {
return "int.Parse(Console.ReadLine())";
}
if (nombre.equals("float")) {
return "float.Parse(Console.ReadLine()... |
53aa09ee-1aa3-4b8a-8f5a-b04fa337c959 | 2 | public Boolean dropGraph(String graphURI) {
if(graphURI==null){
log.warning("to be deleted Graph URI is null");
return false;
}
String query = "DROP SILENT GRAPH <"+graphURI+">";
if(autoCommit){
return this.writeData(query.replace(" ", "+"));
}
this.queries += query.replace(" ", "+")+"\n";
return... |
f48a7023-bb81-49ed-8136-54639b20788c | 8 | public static int[] simularPartido(Cancha cancha, Pelota pelota, int formacionA, int formacionB){
int[] equipoGanador= new int[2];
int comienza=(int)(Math.random()*2+1); //1 o 2
//Primer tiempo
if (comienza==1){
cancha.getEquipoX(0).getJugadorX(0).setTieneBalon(true);
... |
f1d48fb4-90e6-4cc1-9dcd-6c13742b422b | 4 | public void printResult(final String[][] aArray) {
for (final String[] subArray : aArray) {
for (int j = 0; j < subArray.length; j++) {
if (!subArray[j].equals(".")) {
System.out.print(subArray[j]);
} else {
System.out.print(" "... |
f1b33dd6-f2bd-46d6-ae26-6cfc7461492c | 6 | private void heapify(int cur)
{
while (getRight(cur) < heapSize)
{
E left = (E)array[getLeft(cur)];
E right = (E)array[getRight(cur)];
if (comparator.compare(array[cur], left) > 0 ||
comparator.compare(array[cur], right) > 0)
{
... |
7cfa4859-69e3-45f6-a220-93e9cd3bac74 | 2 | public double[] sumColumns() {
int nRows = getRowDimension();
int nCols = getColumnDimension();
double data[][] = getDataRef();
double[] result = new double[nCols];
for (int c = 0; c < nCols; c++) {
result[c] = 0;
for (int r = 0; r < nRows; r++) {
... |
93010cfb-04cf-4019-b68f-b8ac41e06af5 | 6 | public ListNode deleteDuplicates(ListNode head) {
ListNode headNew = new ListNode(-1);
headNew.next = head;
if(head == null || head.next == null)
return head;
ListNode pre = headNew;
ListNode index = pre.next;
boolean isDuplicates = false;
while(index... |
6a8f3bdc-d4f1-4724-84de-a0c17e8971db | 3 | public void paintComponent(Graphics g) {
// Draw a rect around the whole thing
g.fillRect(0, 0, getWidth()-1, getHeight()-1);
// Draw the line separating the top
int spacerY = yPixel(tc.displayBoard.getHeight() - TetrisController.TOP_SPACE - 1);
g.setColor(Color.WHITE);
g.drawLine(0, spacerY, getWi... |
d7d34736-9686-4f25-8a95-10bc735f1c21 | 1 | public static void main(String[] args) {
Thread t = new Thread(new TestThread());
t.start();
try {
t.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("End");
} |
0a8d4fa8-a3cc-42b4-8844-9d9bd16b9d92 | 3 | public void createMusic(){
try {
Sequence musicData = MidiSystem.getSequence(new File("Music Files/"
+ gameMusic +".mid"));
musicPlayer = MidiSystem.getSequencer();
musicPlayer.open();
musicPlayer.setSequence(musicData);
musicPlayer.se... |
a95c142d-3b26-4875-bfeb-9029c1abe51a | 8 | public static void main(String[] args) {
Thread server = new Thread(new Runnable(){
@Override
public void run() {
try {
ServerSocketChannel serverChannel = ServerSocketChannel.open();
ServerSocket serverSocket = serverChannel.socket();
Selector selector = Selector.open();
serverS... |
ea4fab2c-2645-42a8-aafd-23e3c232ebc3 | 6 | public static void initialize(Component canvas) {
keys = new boolean[402];
// MAKE KEY EVENT LISTENER
KeyAdapter keyAdapter = new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e)
{
//System.out.println("Key code: " + e.getKeyCode());
if (keys[e.getKeyCode()] || e.getKeyCode() >=... |
9fd93c49-560e-4618-93a2-3dc5b1d4be42 | 2 | public int OpenTable(int Column, String ID){
//Controllo se l'ID sia presente nella lista
for (int i = 0; i < this._MyTableList.size(); i++) {
if (this._MyTableList.get(i).GetID().equals(ID)) {
//Creo la tabella con il numero di colonne inpostato
this._PdfPTa... |
77a974e8-6b24-429d-a6e4-013a42410b37 | 1 | @Override
public void main() {
cleanOutput();
Creator[] creators = {new ConcreteCreatorA(), new ConcreteCreatorB()};
for (Creator creator : creators) {
Product product = creator.factoryMethod();
addOutput(product.getClass().getSimpleName());
}
super.main("Factory Method");
} |
ca3f5056-f55f-44fb-831f-f73fdb11a9de | 0 | public MealyConfiguration(State state, MealyConfiguration parent,
String input, String unprocessed, String output)
{
super(state, parent);
myInput = input;
myUnprocessedInput = unprocessed;
myOutput = output;
} |
4b0c88ac-dae2-4ad4-a780-c4948f315a4a | 8 | private static Etudiant annulerInscription() {
ArrayList<Etudiant> listeEtudiant = ListeEtudiants.getInstance().getListe(); // Liste des etudiants
int itNoCours = 1; // Compteur pour l'affichage des cours
int itNoEtudiant = 1; // Compteur pour l'affichage des etudiants
int nbEtudiant = 0; ... |
32ee2925-8077-4726-af03-b49efda85083 | 5 | public JSONObject increment(String key) throws JSONException {
Object value = this.opt(key);
if (value == null) {
this.put(key, 1);
} else if (value instanceof Integer) {
this.put(key, ((Integer)value).intValue() + 1);
} else if (value instanceof Long) {
... |
deb92d6e-d44c-4231-98e0-9a16d242e859 | 6 | public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
c743dc1b-4293-4820-b37b-115f4bdaf361 | 3 | public Matrix invertFull() {
Matrix ret = new Matrix();
float[] mat = values;
float[] dst = ret.values;
float[] tmp = new float[12];
/* temparray for pairs */
float src[] = new float[16];
/* array of transpose source matrix */
float det;
/* determinant */
/*
* transpose m... |
f175dc56-f9d4-409d-8f38-dd4641403db9 | 1 | public boolean checkInput(int i, String input) {
if (null == _form[i])
return true;
return _form[i].test.run(input);
} |
4cd93ec0-5b5d-466d-996a-7f97a71eb057 | 4 | public void DropPlayer(int playerID) {
for (Planet p : planets) {
if (p.Owner() == playerID) {
p.Owner(0);
}
}
for (Fleet f : fleets) {
if (f.Owner() == playerID) {
f.Kill();
}
}
} |
497b4ba5-1334-4902-bec3-6b42a17ad7b7 | 2 | public double rate(EnhancedMove move){
int dropHeight = move.getBoard().dropHeight(move.getPiece(), move.getX());
Point[] pos = move.getPiece().getBody();
Board board = move.getBoard();
int gaps = 0;
for(int i = 0; i < 4; i ++){
int x = pos[i].x + move.getX();
int y = pos[i].y + dropHeight;
... |
e64606c3-1ef1-4b09-bca4-4910b43784d9 | 7 | @Override
public void channelRead( ChannelHandlerContext ctx, Object msg ) throws Exception
{
ByteBuf buffer = (ByteBuf)msg;
buffer.markReaderIndex();
boolean needReset = true;
try
{
if(buffer.readUnsignedByte() != 254)
return;
String version = MCListener.pingMcVersion;
if(MCListen... |
39804a88-f9c4-4e10-92b7-afc121fdca05 | 4 | public void reproduction() {
final Getoptions opt = new Getoptions();
//final AudioOption ao = new AudioOption();
try {
byte audio[] = Wuuii.out.toByteArray();
InputStream input = new ByteArrayInputStream(audio);
final AudioFormat format = getTransmissionFormat();
final ... |
575d467f-d1cd-4931-b6d0-b3f49d903e90 | 0 | public String getValue() {
return value;
} |
2100550c-fe13-455d-ab31-fbfd44592f29 | 0 | public ConfigurationController(ConfigurationPane pane,
AutomatonSimulator simulator, SelectionDrawer drawer,
Component component) {
this.configurations = pane;
this.simulator = simulator;
this.drawer = drawer;
this.component = component;
changeSelection();
this.configurations.addSelectionListener(this... |
1841ce51-59db-4a1e-807a-04a8145f06b5 | 0 | public ServiceThread(RendezvousObject robj) {
this.robj = robj;
} |
ccb34268-0789-4795-9126-03cc50fe04ee | 7 | * @param relationname
* @return List
*/
public static List getRelevantRulesForRelation(String modulename, String relationname) {
{ Module module = edu.isi.powerloom.PLI.getModule(modulename, null);
LogicObject relation = edu.isi.powerloom.PLI.sGetRelation(GuiServer.guiNameToPlName(relationname), modul... |
528de754-5ee8-43c9-bc7c-c896494b24a2 | 4 | public boolean downloadFile(String url_, String localPath) {
try {
URL url = new URL(url_.replace(" ", "%20"));
FileOutputStream fstream = new FileOutputStream(new File(localPath));
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
int c... |
dbf5c0de-4f37-4d2a-a875-02be7d3d802f | 0 | public SkillSet getSkillSet()
{
return skillSet;
} |
e48d177d-2433-4e4e-99b7-335dfa077834 | 5 | final void method3528(int i) {
if (i < 45)
aFloatArray7327 = null;
IDirect3DDevice idirect3ddevice
= ((DirectxToolkit) aClass378_7328).anIDirect3DDevice9810;
int i_0_ = ((Class367_Sub5) this).aHa_Sub3_4479.method3941(-103);
Class101_Sub2 class101_sub2
= ((Class367_Sub5) this).aHa_Sub3_4479.method3887... |
f67a8eb8-6f00-4a39-b8b2-b253be628c74 | 8 | public static String encode(String input) {
String nrml = Normalizer.normalize(input, Normalizer.Form.NFD);
StringBuilder stripped = new StringBuilder();
for (int i = 0; i < nrml.length(); ++i) {
char c = nrml.charAt(i);
if (Character.getType(c) != Character.NON_SPACING_MARK
&& (Character.isLetterOrDig... |
1175e09f-81a6-4818-a4db-a8fac7241d03 | 0 | public void setSteps(List<Step> steps) {
this.steps = steps;
} |
98d7bf47-9497-4de9-a992-3830e472415c | 2 | @Override
public boolean canSelectAll() {
for (TreeRow row : new TreeRowViewIterator(this, mRoot.getChildren())) {
if (!mSelectedRows.contains(row)) {
return true;
}
}
return false;
} |
f0652677-7a58-4a66-a90a-ff01a2e6102b | 9 | public static void initialize() {
for (int i=0; i<TERRAIN_TYPE.values().length; i++) {
TERRAIN_IMAGE[i] = MetaData.mainWindow.loadImage("/images/terrain/" + TERRAIN_TYPE.values()[i].toString() + ".png");
}
for (int i=0; i<RESOURCE_TYPE.values().length; i++) {
RESOURCE_IMAGE[i] = MetaData.mainWi... |
a717d892-787c-449c-a8f1-79dd47dccc96 | 8 | public long doUpdate(Master master, UpdateRequest updateRequest) {
incrementAccessAndMaybeRecalibrate(master);
File f = updateRequest.getFile();
Location accessLoc = updateRequest.getLocation();
MasterMeta fm = master.map.get(f.getId());
boolean allSucceeded = true;
long maxDelay = -1;
Set<C... |
325f5640-c83b-4534-ba29-dde5fcf4d81d | 6 | public void cacher(Position pos, int dist){
for (int x=pos.getX() - dist; x <= pos.getX() + dist; x++){
for (int y=pos.getY() - dist; y <= pos.getY() + dist; y++){
if ((x >= 0) && (x < IConfig.LARGEUR_CARTE) && (y >= 0) && (y < IConfig.HAUTEUR_CARTE)){
map[x][... |
7a842335-039d-4686-a415-4553ce85eb1a | 4 | public static void rectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys = scal... |
837e12ec-e720-4035-ad74-87a5d85e2fa5 | 9 | public static float AvgRentsPerMonth(int month, int year, int endMonth, int endYear)
{
//Bij deze kon ik het niet allemaal in de statement steken daarmee heb ik het gedeeltelijk in code gedaan
ArrayList<Integer> avg = new ArrayList<Integer>();
float x=0;
//deze lus loopt de maanden en jaren af. Bij een ma... |
e1ebb07d-493d-42fb-9410-21bd22cf7e63 | 2 | public boolean isOnGround(BlockMap bmap)
{
for(int i = 0; i < bmap.entities.size(); i++)
{
Block tile = (Block) bmap.entities.get(i);
{
if(groundPoly.intersects(tile.poly))
{
return true;
}
}
... |
925a3681-d19b-4e78-8e8a-ee1623bbf2f3 | 8 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String orderid = request.getParameter("orderid");
String orderdat... |
796b7ecd-f74f-481f-b120-6122cc0902c0 | 3 | public Field findFieldWithAnnotation(Class<? extends Annotation> annotationClass) {
for(Field field : getFields()) {
if(field.isAnnotationPresent(annotationClass)) {
return field;
}
}
return null;
} |
56550ce3-2aab-4315-9581-514633be5df4 | 1 | public Color getSelectedColor() {
ColorValue cv = (ColorValue) getSelectedItem();
return null == cv ? null : cv.color;
} |
894442c0-a5a2-4519-9b54-7558cbaebb7e | 8 | public static boolean isValidSnapshot(File f) throws IOException {
if (f==null || getZxidFromName(f.getName(), "snapshot") == -1)
return false;
// Check for a valid snapshot
RandomAccessFile raf = new RandomAccessFile(f, "r");
try {
// including the header and th... |
fbe23bdb-b911-457a-a04d-eca633291492 | 9 | public void set(Protocol con, Component widget, JSONObject obj, Map styleMap) throws JSONException {
if (obj.has("item")) {
JSONArray array = obj.getJSONArray("item");
for (int j = 0; j < array.length(); j++) {
JSONObject itemObj = array.getJSONObject(j);
... |
fd63fd3e-97e5-4337-826e-a96df652de88 | 0 | public Long getCreatedAt() {
return createdAt;
} |
50b04d9b-c1f6-4f89-a933-72d04cc05ad6 | 7 | public Object readMap(AbstractHessianInput in)
throws IOException
{
String name = null;
String type = null;
String description = null;
MBeanParameterInfo []sig = null;
int impact = 0;
while (! in.isEnd()) {
String key = in.readString();
if ("name".equals(key))
name = in.... |
7287aa33-edb3-4059-91ce-dc00ae2ce394 | 2 | private static int findUnfairness(int kids, int[] packets) {
// Sort array using mergeSort O(n logn)
mergeSort(packets);
int minPointer = 0;
int maxPointer = kids - 1;
int minUnfairness = Integer.MAX_VALUE;
// find mininum difference between packets within range kids O(n)
while (maxPointer < packets... |
8d10aee0-b37a-414c-bd71-d8c1bd1fda2d | 8 | public void print(String dataStructure) {
System.out.print(dataStructure + ": ");
for (int i = 0; i < size; i++)
if (heap.get(i) != null)
System.out.print(heap.get(i).element() + " ");
else
System.out.print("--");
System.out.println();
int nBlanks = 32;
int itemsPerRow = 1;
int column = 0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.