method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b8aca764-ee43-4d4a-bc8c-f1cbdc8be70f | 5 | public ConstOperator deobfuscateString(ConstOperator op) {
ClassAnalyzer clazz = methodAnalyzer.getClassAnalyzer();
MethodAnalyzer ma = clazz.getMethod(methodName, methodType);
if (ma == null)
return null;
Environment env = new Environment("L"
+ methodAnalyzer.getClazz().getName().replace('.', '/') + ";"... |
d28af614-62de-4780-9bb0-8f05dcf6031b | 7 | int clear(){
vb.clear();
vd.clear();
os.clear();
if(vi!=null && links!=0){
for(int i=0;i<links;i++){
vi[i].clear();
vc[i].clear();
}
vi=null;
vc=null;
}
if(dataoffsets!=null)dataoffsets=null;
if(pcmlengths!=null)pcmlengths=null;
if(serialnos!=null)serialnos... |
649c57cd-5d5d-4ab9-b47e-f2be89d7d75c | 4 | public boolean put(int key,int value){
LinkedNode root = this;
if(root == null){
return false;
}
while(root.getNext()!=null){
if(root.getKey() == key)
return false;
root = root.getNext();
}
if(root.getKey() == key)
... |
1f413bf3-5c2f-449d-879d-f8ff02087339 | 8 | @Override
public Move makeMove()
{
String input = null;
Boolean inputError = false;
do
{
try
{
if (inputError)
{
_writer.write("Invalid input. Try again.");
_writer.newLine();
}
input = _reader.readLine();
if (input != null && input.charAt(0) == 'q')
retur... |
86d1a230-bfc9-4e06-8b11-3fe83e08bfff | 3 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
if (estaModoEdicao() && exclusaoConfirmada()) {
try {
excluir();
} catch (ValidacaoException ex) {
_unitOfWork.rollback();
... |
a34bed55-4537-4a63-9f2a-528955f258e9 | 1 | public char getItemType(Position position) {
if (!isOccupied(position)) {
return ' ';
}
return field.get(position).getType();
} |
cf0f75c1-7616-46fe-b210-f5be48e6fdcc | 4 | private String pickItem() {
Random rand = new Random();
int num = rand.nextInt(config.getPoorChance() + config.getAverageChance() + config.getGoodChance() + config.getTopChance()) + 1;
if (num <= config.getPoorChance()) {
itemQuality = quality.poor;
return config.getPoorI... |
c9b3e185-0bf9-4a46-84f2-32d7dabc2ef4 | 5 | public void paint(Graphics g) {
Clan clan = clan();
if(clan==null){return;}
super.paint(g);
int r = 0;
String S;
for(Quest q : clan.MB.QuestStack) { //reverse order?
g.drawString(S = q.description(), 2, BHGT+BHGT*r++);
refreshWid(g, S);
}
r = REPORTSTART;
g.drawString("GobLog:", 2, BHGT+BHGT*r++... |
aa7596ab-a9dc-4bb2-8d26-8b7ad74e77a2 | 1 | public String getOutput(State state)
{
if(myMap.get(state) == null)
return "";
else
return (String) myMap.get(state);
} |
1c5fc65f-06cd-4045-8664-a145b25e6f1a | 1 | public void update()
{
if ( oldPos != null )
{
oldPos.set( pos );
oldRot.set( rot );
oldScale.set( scale );
}
else
{
oldPos = new Vector3f( 0, 0, 0 ).set( pos ).add( 1.0f );
oldRot = new Quaternion( 0, 0, 0, 0 ).set( rot ).mul( 0.5f );
oldScale = new Vector3f( 0, 0, 0 ).set( scale ).add( 1.... |
653a2a4f-b08b-4c9c-9d39-dd02139a78de | 6 | public Component getTableCellRendererComponent
(JTable table, Object value, boolean selected, boolean focused, int row, int column)
{
setEnabled(table == null || table.isEnabled());
setBackground(null);
setForeground(null);
if(column==0) {
... |
e9195428-079f-48dc-a834-be6219088129 | 6 | public void calculate(float num)
{
switch(oper)
{
case "+":
total += num;
break;
case "-":
total -= num;
break;
case "*":
total *= num;
break;
case "/":
total /= num;
break;
case " ":
total = num;
case "=":
default:
}
} |
a2f02a44-e42d-44c6-be6f-a6d2226fdde4 | 9 | protected void readAndSaveFile(MultipartStreamHandler aStream, String aBoundary, String aFilename) throws IOException
{
File f = new File(fSaveDir + File.separator + aFilename);
FileOutputStream fout = new FileOutputStream(f);
BufferedOutputStream bout = new BufferedOutputStream(fout, 8196);
... |
31621c3e-3808-4a99-9bce-5a7eeb2c99ba | 0 | public int size() {
return queue.size();
} |
c687cea8-dc3f-4bad-a459-09e82e9a1bb3 | 4 | public static void deleteDirectory(File file) {
if (file.exists()) {
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File f : files) {
if (f.isDirectory()) {
deleteDirectory(f);
} else {
f.delete();
}
}
}
file.delete();
}
} |
3c1d1f16-b612-42bb-928f-2b73e95e58b7 | 4 | @Override
public Value evaluate(Value... arguments) throws Exception {
// Check the number of argument
if (arguments.length == 1) {
// get Value
Value value = arguments[0];
// If numerical
if (value.getType().isNumeric()) {
return new Value(new Double(Math.acos(value.getDouble())));
}
if (v... |
34fe77cc-4422-4a10-8be4-76c3fe6f843f | 4 | @Override
public double evaluate(int[][] board) {
int max = 0, secondMax = 0;
int maxX = -1, maxY = -1, sMaxX = -1, sMaxY = -1;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if(board[i][j] > max) {
secondM... |
5bd477b7-eaef-4216-b18d-b18923e4233a | 3 | public static String trimAllWhitespace(String str) {
if (!hasLength(str)) {
return str;
}
StringBuilder sb = new StringBuilder(str);
int index = 0;
while (sb.length() > index) {
if (Character.isWhitespace(sb.charAt(index))) {
sb.deleteCharAt(index);
}
else {
index++;
}
}
return sb.t... |
203e9463-c7b6-4a7a-846e-35e38e3baa80 | 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 Option)) {
return false;
}
Option other = (Option) object;
if ((this.idOption == null && other.idOption != null... |
ac8817d7-4842-4dfe-b938-73ce13ec44fb | 9 | private void parse(String json) throws JsonException {
final String res = json.trim();
// Try trivial variants
if ("{}".equals(res) || "{ }".equals(res)) { // Empty Object
this.type = JsonType.OBJECT;
objectData = new HashMap<>();
return;
}
if... |
c2205b7e-e808-4c3e-b9e8-1c174331954e | 7 | public void doRunKeys(int run) throws Exception {
if (m_ResultProducer == null) {
throw new Exception("No ResultProducer set");
}
if (m_ResultListener == null) {
throw new Exception("No ResultListener set");
}
if (m_Instances == null) {
throw new Exception("No Instances set");
... |
020b7af4-ccf0-4f58-99ed-8050ee564a6a | 3 | @WebMethod(operationName = "ReadStock")
public ArrayList<Stock> ReadStock(@WebParam(name = "stock_id") String stock_id) {
Stock stock = new Stock();
ArrayList<Stock> stocks = new ArrayList<Stock>();
ArrayList<QueryCriteria> qc = new ArrayList<QueryCriteria>();
if(!st... |
ec4bb458-f183-4844-9915-953d2c48fbf2 | 4 | public static String readPropeties() {
System.out.println("Entering readProperties() in "+DATE_FORMAT.format(new Date()));
Thread.currentThread().setName("ReadProperties-"+COUNT++);
Properties protoProp = new Properties();
String propLoc = "message.properties";
String root = "C:\... |
dd54412d-20f8-4a3d-b501-143d75ce4a72 | 7 | public void load()
{
ready=false;
BufferedImage temp = getImage( FileName );
if( temp!=null )
{
int xFrame = temp.getWidth(null);
int yFrame = temp.getHeight(null);
int counter_x, counter_y ;
boolean set=false;
if( scale )
{
xSize=(short)xFrame; ySize=(short)yFrame;
xHalf=(short)(x... |
2905638d-b4b1-4391-b49d-0c135b7abad6 | 3 | private int readLength() throws StreamCorruptedException {
StringBuffer lenStr = new StringBuffer();
while (input.remaining() > 0) {
char ch = input.get();
if (ch == ':') {
//indexPlus(1);
break;
} else {
lenStr.append(ch);
}
}
int arrayLen = 0;
try {
arrayLen = Integer.valueOf(lenS... |
cddcc67c-1020-4fe5-9477-ed41fd7953c0 | 1 | public void addAccount(BankAccount account) throws IllegalArgumentException {
if (! canHaveAsAccount(account))
throw new IllegalArgumentException();
accounts.add(account);
} |
08e309b9-b5c9-467b-84c2-3ba5843e6b85 | 7 | private boolean processCommand(Command command)
{
boolean wantToQuit = false;
CommandWord commandWord = command.getCommandWord();
switch (commandWord) {
case UNKNOWN:
System.out.println("I don't know what you mean...");
tryMoveCharacters();
... |
4ae45c89-7462-4f30-a0a7-9ae2c246db1a | 2 | @Override
public boolean startVideoProcessing(File videoFile) {
if (this.window == null || this.adFinder == null)
return false;
return this.adFinder.startVideoProcessing(videoFile);
} |
fa666416-cfb6-4874-817e-7a60bcc9786c | 3 | public void addBestModel(List<CartsModel> toadd) {
for (CartsModel cm : toadd) {
if (locm.isEmpty()
|| locm.get(0).getModel_bandwith() > cm.getModel_bandwith()) {
locm.clear();
locm.add(cm);
}
}
} |
3d813f70-4ed7-4f34-84be-28b39da8b4a4 | 8 | public boolean search(String word) {
Queue<TrieNode> queue = new LinkedList<TrieNode>();
TrieNode node = root;
queue.add(node);
int index = 0;
while (!queue.isEmpty()) {
if (index == word.length())
return true;
TrieNode curr = queue.poll();
if (index == word.length() - 1)
return curr.flag;
... |
da81d728-3048-4da7-9dbe-c3c461393e78 | 0 | protected Component getView() {
return view;
} |
31af69ce-0848-4c23-b834-954e73dfc795 | 8 | public ListNode detectCycle(ListNode head) {
ListNode fast = head;
ListNode slow = head;
if(head == null) {
return null;
}
if(head.next == null) {
return null;
}
if(head.next.equals(head)) {
return head;
}
int fastSpeed = 2;
boolean firstMeet = true;
while(fast.next != null) {
for(int ... |
06ca9a10-6f62-4921-8728-06bbafe6e9df | 4 | @Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
DatabaseManager manager=DatabaseManager.getManager();
String begin=request.getParameter(Booking.BEGIN);
String end=request.getParameter(Booking.END);
try {
if(!MyServlet.isEmpty(begin... |
0d0e4285-0b09-4850-bdf0-9a1756f22dda | 9 | public String nextToken() throws JSONException {
char c;
char q;
StringBuffer sb = new StringBuffer();
do {
c = next();
} while (Character.isWhitespace(c));
if (c == '"' || c == '\'') {
q = c;
for (;;) {
c = next();
... |
15c10b1a-facb-4441-9cfd-d34ab079dbd2 | 2 | public void menuUpdate(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException{
if(playTheme ==true){
theme.playAsSoundEffect(1.0f, 1.0f, false);
playTheme=false;
Mouse.setGrabbed(false);
}
else{}
if(Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)){
Screen=0;
}
} |
f744c95b-e453-4385-ace8-026454d3feff | 7 | public JComponent createAbsolute_Position()
{
JTabbedPane tabbedPane = new JTabbedPane();
// Pos tab
final JPanel posPanel = createTabPanel(new MigLayout());
posPanel.add(createButton(), "pos 0.5al 0al");
posPanel.add(createButton(), "pos 1al 0al");
posPanel.add(createButton(), "pos 0.5al 0.5al");
posP... |
33db2fab-d890-44d6-8fae-445dcf3aa1b8 | 0 | public String getName() {
return name;
} |
f11227a3-36a7-4301-8047-1b69b92bab2d | 8 | public static ArrayList<ArrayList<Integer>> zigzagLevelOrder2(TreeNode root) {
ArrayList<ArrayList<Integer>> resultLists = new ArrayList<ArrayList<Integer>>();
if (root == null) {
return resultLists;
}
Stack<TreeNode> currentLevel = new Stack<TreeNode>();
currentLevel.push(root);
Boolean leftToRight = fa... |
923cbdda-006d-40bb-a4d4-ec6fb11b942a | 1 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (bodyBlock == oldBlock)
bodyBlock = newBlock;
else
return false;
return true;
} |
37dd4181-00c2-4faf-9a48-2d586b16dd23 | 0 | public Object GetConfig(String section, String option)
{
//get hashtable for the section
Hashtable tmp = (Hashtable)configSections.get(section.toUpperCase());
//get the value of the option
return tmp.get(option.toUpperCase());
} |
0fe9a8fb-05b5-44b5-be72-445bf85a7805 | 5 | public int nextSetBit(int fromIndex)
{
if (fromIndex < 0)
throw new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex);
checkInvariants();
int u = wordIndex(fromIndex);
if (u >= wordsInUse)
return -1;
long word = words[... |
d76f7808-7036-469d-9614-2fecaa2c421e | 8 | private boolean checaTipoDaVariavelEmRegistro(String nomeVariavel, String tipoDoRetorno) {
if(!listaVariveisRegistro.isEmpty()){
if(!listaDeBlocos.isEmpty()){
for(int j=0;j< listaDeBlocos.size();j++){
String [] tabela1 = listaDeBlocos.get(j).split("~");
... |
64641987-74a1-4e5f-9129-09c7547a33a3 | 3 | private Integer[][] goDijkstra(int x, int y) {
int profondeur = 0;
Integer dijkstra[][] = new Integer[taille_envi][taille_envi];
Stack<Point> toDo = new Stack<Point>();
toDo.add(new Point(x, y));
for (int j = 0; j < taille_envi; j++) {
for (int i = 0; i < taille_envi; i++) {
dijkstra[i][j] = -1;
}
... |
15b81d2c-328c-4282-a979-32d612969599 | 7 | private boolean isConstant(String token) throws Exception {
//check if character constant
if ( token.startsWith("'") ) {
if (token.endsWith("'") && token.length()<=3) {
return true;
} else {
throw new Exception("Wrong chacter constant!");
... |
3db3f826-f53a-43a0-b81e-1b47b22324d6 | 7 | private String principalComponentsSummary() {
StringBuffer result = new StringBuffer();
double cumulative = 0.0;
Instances output = null;
int numVectors=0;
try {
output = setOutputFormat();
numVectors = (output.classIndex() < 0)
? output.numAttributes()
: output.numAttr... |
83c5d43c-46c6-43f6-b129-d75d0d085b75 | 4 | @Test
public void testThrowsOnIncorrectSignatur() {
try {
assertNotNull(Sx.mk(new SxController() {
@Selector("s")
void f1() {
}
}));
fail("Should throw");
} catch (RuntimeException ex) {
}
try {
assertNotNull(Sx.mk(new SxController() {
@Selector("s")
void f2(String a1, HashMap<?... |
57e651d7-d27e-4c58-9db9-7392689af035 | 2 | @Override
public void run(ListIterator<Instruction> iter)
throws Exception {
Instruction i = iter.next();
if(i instanceof ArrayIndex) {
iter.remove(); // remove instruction i
ArrayList<Instruction> code = ((ArrayIndex)i).getIndexingCalculation();
BasicBlo... |
54589ac4-6991-4659-8e10-d3ae7d819fa2 | 3 | private void downloadSong(final SongConfig song, final FolderConfig folderConfig) {
String trackString = null;
try {
final HttpResponse trackResponse = getApi().get(new Request(String.format(Constants.TRACK_URL, song.getTrackId(), Constants.CLIENT_ID)));
trackString = EntityUtils.toString(trackResponse.getEnt... |
febc3ffe-e28e-4a9d-9f74-1cbbbd201ac0 | 2 | static void decompress(BitInputStream in, OutputStream out) throws IOException {
FrequencyTable freq = new SimpleFrequencyTable(new FlatFrequencyTable(257)); // Initialize with all symbol frequencies at 1
ArithmeticDecoder dec = new ArithmeticDecoder(in);
while (true) {
int symbol = dec.read(freq);
if (sym... |
38c4a5b9-29e4-456a-802e-af9f8ac59801 | 8 | private boolean readTape(InputStream stream) {
byte[] start = new byte[32];
dirNames.clear();
dirEntries.clear();
type = TAPE;
try {
DataInputStream reader = new DataInputStream(stream);
reader.readFully(start);
String st = new String(start);
if (st.startsWith("C64")) {
... |
a57a1ecf-ba56-4b00-a9cc-6116656327bb | 1 | public void addWay(int pos, long wayId){
if (!ways.contains(wayId))
ways.add(wayId);
} |
861304ee-e3e3-48d9-b1d5-f9b67a4f4480 | 4 | public static void main(String[] args) throws Exception
{
int p[] = { 30, 35, 15, 5, 10, 20, 25 };
TDMatrixChainMultiplication td = new TDMatrixChainMultiplication(p);
System.out.println("Number of scalar multiplications");
for (int i = 1; i < p.length; i++)
{
for (int j = i; j < p.length; j++)
Syste... |
301e08c2-f158-42c2-895b-2a03a4b7ec11 | 4 | @Override
public void draw(SpriteBatch batch, float parentAlpha) {
if (MyStage.isCameraView(stage, x, y)) {
update(Gdx.graphics.getDeltaTime());
if (isDead) {
batch.draw(deadTexture, x - 32, y - 32, originX, originY, width, height, 1, 1, rotation);
} else ... |
96d15e1a-92b0-4c2d-ba7d-91b400ccce6e | 9 | @Override
public void executeMsg(final Environmental myHost, final CMMsg msg)
{
super.executeMsg(myHost,msg);
if((msg.source().location()!=null)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&((msg.value())>0)
&&(msg.tool()==this)
&&(msg.target() instanceof MOB)
&&(!((MOB)msg.target()).amDead())
&&(CMLib.f... |
989e6219-5fb1-4455-8e70-409a5fb849e7 | 1 | public static JSONObject showNotFound() {
JSONObject jo = new JSONObject();
try
{
jo.put("rtnCode", "404 not found");
} catch (JSONException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return jo;
} |
0799b243-0835-43f8-a13b-ebc502b1f7db | 2 | public String toString()
{
StringBuilder s = new StringBuilder("[");
for(T x : this)
s.append(Objects.toString(x) + ", ");
if(size > 0)
s.setLength(s.length() - 2);
s.append("]");
return new String(s);
} |
4f1f76d1-fdfb-46b9-a8a7-35fa6ef45b94 | 4 | public void buscarNome(String nome){
ResultSet rs;
String sql = "SELECT * FROM alunos";
String nomes="Matric | Nome | Endereco\n\n";
try{
rs = meuState.executeQuery(sql);
while(rs.next()){
if(rs.getString("nome").toUpperCase().... |
1c2dee96-7165-444f-903d-7021df454512 | 7 | public void func_50020_b(int par1)
{
if (this.text.length() != 0)
{
if (this.field_50048_p != this.field_50042_o)
{
this.func_50031_b("");
}
else
{
boolean var2 = par1 < 0;
int var3 = var2 ? t... |
9aa96667-4956-49f6-b763-3c08e61f564f | 4 | public static Object getValue(Object object, String fieldName) throws JStrykerException, IllegalArgumentException {
if (object == null) {
throw new IllegalArgumentException("Object cannot be null.");
}
if (fieldName == null) {
throw new IllegalArgumentException("Field name cannot be null.");
}
try {
... |
a5e7ceb5-1782-46c0-9f08-c7435b7046ef | 6 | private void DownloadFormButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DownloadFormButtonActionPerformed
//Get selected value and split it to get the first integer
// which is the ID of the form
String ID = (String) FormsList.getSelectedValue();
String[] test = ID.split(" ");
... |
dae2e567-3020-4f46-8b43-bcf020370f99 | 2 | public String toString() {
StringBuilder s = new StringBuilder();
String NEWLINE = System.getProperty("line.separator");
s.append(V + " vertices, " + E + " edges " + NEWLINE);
for (int v = 0; v < V; v++) {
s.append(String.format("%d: ", v));
for (int w : adj[v]) {... |
de8f3d2e-402f-465b-8b4c-6c81dffe1e91 | 0 | @Override
public IEmailKontakt create() {
EmailKontakt ek = new EmailKontakt();
return ek;
} |
1145726a-9e85-43f4-9d79-7137a2955b4d | 5 | private void createChromaticityCombo(PrintRequestAttributeSet set) {
Chromaticity[] chromacities = (Chromaticity[]) mService.getSupportedAttributeValues(Chromaticity.class, DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);
if (chromacities != null && chromacities.length > 0) {
HashSet<Chromaticity> possible = new Ha... |
568fd1a5-a410-4b2a-861e-a3d86c0399a9 | 3 | @Override
public boolean equals(Object obj) {
ItemSet itemSet = (ItemSet) obj;// necessary casting
if (this.itemSet.size() == itemSet.getItemSet().size()) {
for (int i = 0; i < this.itemSet.size(); i++) {
if (!this.itemSet.get(i).getItem()
.equals(itemSet.getItemSet().get(i).getItem())) {
return ... |
0caac513-4eba-4f98-9afd-a7aa154104c2 | 9 | protected void processRequest(HttpServletRequest request, HttpServletResponse response) {
ArrayList<Producto> lista = null;
String strChkCategoria = request.getParameter("chkCategoria");
String strChkMarca = request.getParameter("chkMarca");
boolean filtrarCategoria = false;
bool... |
0659d49f-5284-406d-b157-5ed7e6224137 | 6 | public static MethodSlot createEvaluatorWrapperUnit(MethodSlot method) {
{ boolean variableargumentsP = ((BooleanWrapper)(KeyValueList.dynamicSlotValue(method.dynamicSlots, Stella.SYM_STELLA_METHOD_VARIABLE_ARGUMENTSp, Stella.FALSE_WRAPPER))).wrapperValue;
boolean evaluateargumentsP = method.methodEvaluateArg... |
2d7c5c32-b9a8-4945-b597-93f03e692c48 | 2 | public boolean matchesNumber(String text) {
int numberCount = this.numberList.size();
for(int i = 0;i<numberCount;i++) {
String currentNumber = this.numberList.get(i).getLiteral();
boolean isMatchingExpression = text.equals(currentNumber);
if (isMatchingExpression) {
return true;
}
}
return f... |
c03eb898-a3c0-4f60-b646-12cf475851a0 | 2 | private void paintGrille(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
// Paint le grillage selon la dimension
g2d.setColor(Color.black);
int separattion;
// Lignes Horizontale
for(separattion=0 ; coordonneJeu.getNombreColonne()> separattion; separattion++)
... |
146b8482-e9be-4c36-ab46-2cfd00c50178 | 3 | protected static String convertColorToWebColorValue(Color c) {
String red = Integer.toHexString(c.getRed());
if (red.length() == 1) {
red = "0" + red;
}
String green = Integer.toHexString(c.getGreen());
if (green.length() == 1) {
green = "0" + green;
}
String blue = Integer.toHexString(c.getBlue());... |
2000a1ee-54d4-4c62-9898-7f56ab26e4c3 | 4 | public static void copyDirectory(File sourceLocation , File targetLocation) throws IOException {
if (sourceLocation.isDirectory()) {
if (!targetLocation.exists())
targetLocation.mkdir();
String[] children = sourceLocation.list();
for (int i=0; i<children.length; i++)
copyDirectory(new... |
c088d1e3-0f0c-4e80-adeb-cb480705bde0 | 0 | public void insert(String name) {
Occurrence newOcc = new Occurrence(name);
newOcc.next = head;
head = newOcc;
} |
0555e59a-820f-446f-beab-a89e8438beae | 5 | public float advanceUpgrade(float progress) {
if (upgradeIndex == -1) upgradeIndex = nextUpgradeIndex() ;
if (upgradeIndex == -1) return 0 ;
//
// Update progress, and store the change for return later-
final int US = upgradeStates[upgradeIndex] ;
final float oldP = upgradeProgress ;
upgrad... |
420c701b-1811-46d9-92f3-6f0f75f3d3ab | 1 | @Test public void checkImageGeneration() {
try {
reduct.setSourceImage(ImageIO.read(new File("src/test/resources/Mario.png")));
reduct.setDestBitDepth(3);
reduct.generateImage();
assertTrue(reduct.getReducedImage() != null);
} catch (IOException e) {
... |
d500a94e-2bb4-4913-8968-8578d5522e7b | 3 | public double getMinValue() {
if(times.length == 0) {
return -1;
}
double minval = times[0];
for(int i = 1; i < times.length; i++) {
if(times[i] < minval) {
minval = times[i];
}
}
return minval;
//returns minimum value of times-array
} |
9826c37a-c37b-43f2-ab90-c6039b6c5e09 | 9 | public static boolean isCubeInFrustum(float x, float z, float y, float size) {
for(int p=0;p<6;p++) {
if(frustum[p][0]*(x-size) + frustum[p][1]*(y-size) + frustum[p][2]*(z-size) + frustum[p][3]>0)
continue;
if(frustum[p][0]*(x+size) + frustum[p][1]*(y-size) + frustum[p][2]*(z... |
66d2d553-db25-4fd9-8560-8da8d17ca715 | 8 | public static void main(String[] args) {
try {
Console console = System.console();
if (console == null) {
System.err.println("Error : No console ! Please run it with command line :).");
System.exit(1);
}
// System.setSecurityManager(new java.rmi.RMISecurityManager());
ILoginModule lm = (ILogi... |
500b0c5e-4c84-4294-8b17-c6b54cdbabb4 | 9 | @Override
protected boolean validateNode(Node<T> node) {
boolean bst = super.validateNode(node);
if (!bst)
return false;
AVLNode<T> avlNode = (AVLNode<T>) node;
int balanceFactor = avlNode.getBalanceFactor();
if (balanceFactor > 1 || balanceFactor < -1) {
return false;
}
if (avlNode.isLeaf()) {
... |
fed273d9-11c7-4649-a171-f5d5384fbbd6 | 7 | public static void drawWave (Graphics g, Wave wave,
int x, int y, int width, int height,
int viewStart, int viewEnd,
boolean selected,
int selectStart, int selectEnd)
{
double[] w;
if (wave != null && (w = wave.getWave()) != null) {
double samplePos... |
1d384206-68d7-45f6-9d7b-53595dbabe5c | 7 | void init(Molecule molec, EnergyFunction ef, double cutoff, DoubleMatrix1D dv,
ContSCObjFunction of, DoubleMatrix1D[] samples){
//Take the VDW interactions with distances below distCutoff
//if of and samples aren't null then count distances below distCutoff in any of the samples
//(f... |
3bfff184-5184-4ae3-a5c9-23cd63d12ebf | 8 | @Override
public HashSet<Square> calcMoves(ChessBoard board) {
moves = new HashSet<Square>();
for(int i = 1; checkMove(board.getSquare(x+i, y)); i++) {}
for(int i = 1; checkMove(board.getSquare(x-i, y)); i++) {}
for(int i = 1; checkMove(board.getSquare(x, y+i)); i++) {}
for(int i = 1; checkMove(board.getSqua... |
e56a5c8d-512a-4809-bebe-06d4538e9550 | 4 | public void addCustomer(Customer cust) {
Connection con = null;
PreparedStatement pstmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
f59539b7-47bb-4ff5-8526-d543c3b99bd7 | 0 | @Override
public void keyTyped(KeyEvent e) {
} |
dea56863-7846-4921-a36e-e9c4301eecfc | 6 | private static void quickSort(char[] arr, int low, int high) {
int i = low, j = high;
int pivot = arr[low + (high - low)/2];
while(i <= j) {
while(arr[i] < pivot)
i++;
while(arr[j] > pivot)
j--;
if(i <= j) {
exchange(arr, i, j);
i++;
j--;
}
}
if(low < j)
quickSort(arr, low, ... |
ddaeb4e2-2dbd-4d8e-979e-3df934b894c9 | 5 | public double[] estimateGlobalLM(){
double[] lm = new double[getLMFeatureSize()];
double sum = 0;
for(_User u: m_users){
for(_Review r: u.getReviews()){
for(_SparseFeature fv: r.getLMSparse()){
lm[fv.getIndex()] += fv.getValue();
sum += fv.getValue();
}
}
}
for(int i=0; i<lm.length; i+... |
dedc3dce-7084-4927-96c0-caed1e5e9dcc | 8 | protected static Ptg calcDCountA( Ptg[] operands )
{
if( operands.length != 3 )
{
return new PtgErr( PtgErr.ERROR_NA );
}
DB db = getDb( operands[0] );
Criteria crit = getCriteria( operands[2] );
if( (db == null) || (crit == null) )
{
return new PtgErr( PtgErr.ERROR_NUM );
}
int fNum = db.find... |
0bf08dc4-313c-40a0-97ca-4de0fe661c48 | 2 | public int dropHeight(Piece piece, int x) {
int[] skirt = piece.getSkirt();
int minDistIndex = 0;
int dist = height + 10;
for (int row = 0; row < skirt.length; row++) {
int checkDist = height - getColumnHeight(x + row) + skirt[row];
if (checkDist < dist) {
dist = checkDist;
minDistIndex = row;
... |
d393ecbe-4811-42fa-9b32-5bee7a029ca1 | 2 | public static void main(String[] args) {
AuctionSystemServer server = new AuctionSystemServer();
AuctionConsole console = new AuctionConsole();
Alerter.setHandler(console);
server.init();
String input;
// Read input and repeat until "stop" is entered.
do {
input = console.readLine();
} while (input ... |
daac5c0c-cc71-4745-ad29-95d44f56f773 | 8 | public ArrayList<Position> inNeighboring(char[][] board, Position p, char x, int xSize, int ySize) {
ArrayList<Position> neighbor = new ArrayList<Position>();
if (p.x + 1 < xSize && board[p.x + 1][p.y] == x) {
neighbor.add(new Position(p.x + 1, p.y));
}
if (p.x - 1 >= 0 && bo... |
aa6e7960-8c5d-4255-a16d-47c228531ace | 0 | public AttemptClientConnectEvent(Object source, ISocketServerConnection socketServerConnection) {
super(source);
this.setSocketServerConnection(socketServerConnection);
} |
f7a2b1dc-eed4-40b5-9129-9010503c3455 | 4 | private Box getDominantBox()
{
Box best = null;
int bestDim = 0;
for (Box b : boxes)
{
int dim = b.dominantDimension();
if ((dim > bestDim || best == null) && b.canSplit())
{
bestDim = dim;
best = b;
}
... |
1fa083f8-494e-4480-9cc0-b6ba61bef07a | 2 | private boolean find(int n, int k) {
boolean result = false;
while (n > 0) {
if (n % 10 == k) {
result = true;
break;
} else
n = n / 10;
}
return result;
} |
d556d8cf-282e-478b-864d-e58938c9bc8d | 4 | public void simulateRound() {
List<MovableObject> movableSnapshot = new ArrayList<>(mMovableObjects);
//iterate over snapshot since some interactions can modify movable list
for (MovableObject movable : movableSnapshot) {
Point2D nextPosition = movable.move();
if (!isInsi... |
9cf9b9ea-18a1-4a8f-8dbb-d2f0e863f1f9 | 0 | public double getSimilarity()
{
return _similarity;
} |
72c49b0e-40b6-47ba-b006-ac5fa261007c | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
WeaponPerKiller other = (WeaponPerKiller) obj;
if (killer == null) {
if (other.killer != null) {
return false;
}
} ... |
8669f8a6-9306-4bd7-83f3-34b79f46fafc | 4 | @Override
public void mouseWheelMoved(MouseWheelEvent arg0)
{
//how much does the wheel turned?
int howMuch = arg0.getWheelRotation();
//how loud is the sound at the moment?
int percentage = audioSlider.getValue();
//no decision about how much the wheels turns
//use for every event just one st... |
bd5b0a33-986f-4c42-ad13-90c5ed61e2c1 | 0 | public Transition[] getTransitions() {
return transitions;
} |
5ac290cc-8576-4a7a-87a5-0acfc0b62877 | 2 | public void setDAO(String daoLine) {
if (daoLine.equals("Mock")) {
dao = new MockDAO();
}
else if (daoLine.equals("MySQL")) {
dao = new MySQLDAO();
}
} |
f753c84a-f3bf-4224-a01b-4bbd9364381b | 6 | @Override
public void crash(final HTML container, final CSSClass cssClass) {
if ( Constants.fdebug )
Constants.logger.info("Logging " + this.getName( ));
final HTML h4 = HTML.create("h4", container);
h4.setValue("Dump of Registry");
final HTML table = HTML.create("table", container);
HTML tr = null;
... |
212f7405-88c4-49b4-9641-e757e1876b21 | 8 | @Override
public String getString()
{
try
{
try
{
// Object o= ((Formula) this.getParentRec()).getInternalRecords().get(0); PARENT REC of ARRAY or SHRFMLA is determined by referent (record) NOT necessarily same as actual Parent Rec
Boundsheet sht = getParentRec().getSheet();
// Formula pr= (Fo... |
2d15aa6a-59cd-4a91-a91d-d1e13184c453 | 9 | public void run()
{
synchronized(taskList)
{
while( true )
{
long time = System.currentTimeMillis();
if( nextTime <= time )
{
nextTask.getTask().runWatchdogTask(time);
nextTask.setLastExecMillis(time);
updateNextTask();
}
if( nextTask != null && taskList.size() > 0 )
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.