method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
272d696e-4612-4217-91cc-443f1911fa2b | 8 | protected boolean noiziseOneSeq2(Vector<Event> os, Vector<Event> ns){
int noiseLen=(int)(errorRate*os.size());
if(os.size()-noiseLen<0){
System.out.println("one sequence: os.size()-noiseLen<0");
return false;
}
if(noiseLen<=1){
System... |
51cddebd-d61a-4bcd-aa43-c323506bae86 | 2 | static void input(double[][] matrix){
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[i].length; j++){
matrix[i][j] = scan.nextDouble();
}
}
} |
25a240ab-2586-493d-b844-4cb28d38849b | 4 | static public void main(String args[])
{
String[] argv;
long start = System.currentTimeMillis();
int argc = args.length + 1;
argv = new String[argc];
argv[0] = "jlc";
for(int i=0;i<args.length;i++)
argv[i+1] = args[i];
jlcArgs ma = new jlcArgs();
if (!ma.processArgs(argv))
System.exit(1);
Con... |
3e6a6f0a-3a20-4ab0-8b0f-aa8990e4fa52 | 3 | @SuppressWarnings("unchecked")
private boolean equals(List<GedcomTag> gedcomTags, List<GedcomTag> compareGedcomTags) throws SAXParseException, IOException {
// merge CONC tags
mergeContConcTags(gedcomTags);
mergeContConcTags(compareGedcomTags);
// remove empty tags
removeEmptyTags(gedc... |
27feeca9-dcf7-4b0a-858d-75b2d69f9697 | 3 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if(o == null) return false;
if (!(o instanceof Faction)) return false;
Faction faction = (Faction) o;
return this.name.equalsIgnoreCase(faction.getName());
} |
9ea58b29-6c1c-4cd2-9a4e-d9f17b4214c5 | 5 | public boolean loadEquipment(String equipment, int requiredTechLevel)
{
//if the spaceship techlevel could not meet with weapon techlevel requirement, can't install
if(isEquipmentSlotsFull() || requiredTechLevel > techLevel)
return false;
else
{
i... |
2fbe2196-43b2-42c5-b8c4-9e5415fb83ee | 6 | @EventHandler
public void WolfPoison(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.getWolfConfig().getDouble("Wolf.Poison.DodgeCh... |
3fea4b04-20fa-4fce-8da6-d694a302d6c7 | 4 | public SudokuPanel() {
super(new GridLayout(3, 3));
panels = new JPanel[3][3];
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
panels[y][x] = new JPanel(new GridLayout(3, 3));
panels[y][x].setBorder(BorderFactory.createLineBorder(Color.DAR... |
d0a712c7-b30c-4578-8ed0-1fb663987b20 | 8 | public IJavaVersion getValidJavaVersion(JavaVersionRepository repository) {
boolean requires64Bit = getMemory() > Memory.MAX_32_BIT_MEMORY;
IJavaVersion best64Bit = repository.getBest64BitVersion();
if (best64Bit != null && isJavaValid(best64Bit.getVersionNumber()))
return best64Bi... |
e21a0bf4-2656-473f-a205-5842c61a477e | 0 | @Override
public int getScheduleSize() {
return 0;
} |
a60584de-8e73-4f12-8595-67ce92d98ae4 | 9 | static void populateBindings(KeystrokeTableModel model) {
TreeMap<String, ArrayList<String>> items = new TreeMap<String, ArrayList<String>>();
Preferences bindings = PREFS.node("bindings"); //$NON-NLS-1$
try {
for (String key : bindings.keys()) {
String act = bindings.get(key, null);
i... |
df5fdfdf-5e91-4642-b8b8-8868d4a274e2 | 7 | private void draw(Point p) {
p = convert.map(new Point(p.x-map.height*20-20,p.y));
for (int i= -Cursor.size/2;i<=Cursor.size;i++)
for (int j= -Cursor.size/2;j<=Cursor.size;j++)
if(p.x+i < map.width && p.x+i >= 0 && p.y+j < map.height && p.y+j >= 0){
map.field[Cursor.ebene][new Point(p.x+i,p.y+j).x][new ... |
0005f2fd-b2b3-4bd2-9d45-176d037d0f9c | 6 | @Override
public void isAsetForController(ICard cardOne, ICard cardTwo,
ICard cardThree, int player) {
if (isAset(cardOne, cardTwo, cardThree)) {
if (this.playerOne == player) {
this.playerOneCounter = this.playerOneCounter + 1;
} else if (this.playerTwo == player) {
this.playerTwoCounter = this.pla... |
b2a7e2d1-321f-4c50-ba3d-3aa88ddd0f92 | 7 | @Override
public boolean okMessage(final Environmental myHost, final CMMsg msg)
{
if(!super.okMessage(myHost,msg))
return false;
if(affected==null)
return true;
if(!(affected instanceof MOB))
return true;
if(msg.target()==affected)
{
if((msg.tool()!=null)
&&(CMLib.dice().rollPercentage()>... |
8e807b71-b36c-409a-a99c-b64ceb92eec1 | 5 | public void run() {
while (true) {
//System.out.println("in FullBackBrain");
try {
Thread.sleep(100);
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if(f.getMem().timeCheck(f.getTime())) {
f.setTime(f.getMemTime());
try {
f.run... |
2768555e-bd39-4728-99fe-ba3c9123f9d2 | 3 | public int compareAlbum(Album otherAlbum) {
int similarSongCount = 0;
HashMap<String, Song> other = otherAlbum.getTracks();
Set keySet = other.keySet();
Iterator i = keySet.iterator();
while(i.hasNext()) {
String tmpName = (String)i.next();
if(tracks.containsKey(tmpName)) {
Song localSong = tracks.g... |
23a78fc7-6380-4d53-a90b-999b08dd7d9a | 9 | public static Message parse(String data)
{
int pos = 0; //Current position in string
int oldPos;
String prefix = "";
//Trim the data
data = data.trim();
try
{
//Extract prefix
if(data.charAt(0) == ':')
{
//Find first space and extract until that
pos = data.indexOf(' ') + 1;
prefix... |
5bf27c6e-a1c9-4892-a1da-091f334ed209 | 7 | public static void startupClasses() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.$STELLA_MODULE$);
Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
if (S... |
678059ad-d58a-451a-9239-cb5e393a5438 | 2 | public void initiateRemoval() {
if(this.isRemoving) return;
this.isRemoving = true;
try
{
this.save();
} catch (SQLException e)
{
e.printStackTrace();
}
UserRemovalInitiated notification = new UserRemovalInitiated(this);
Notification.add(this.getId(), notification);
} |
b9b9bc06-ef21-4226-b0b4-2f77eb3b5185 | 0 | public String getDepartment() {
return department;
} |
2d6c7028-511d-454f-badd-6fa067716912 | 5 | static final private Token thingParam() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case TOKENWORD:
t = jj_consume_token(TOKENWORD);
{if (true) return t;}
break;
case ACCESSOP:
jj_consume_token(ACCESSOP);
t = jj_consume_token(TOKE... |
df2f7e9d-5601-476c-9e08-099e9eb223c7 | 9 | public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n=in.nextInt();
char[][] out = new char[2000][1000];
for(int i=0;i<2000;i++)
Arrays.fill(out[i], ' ');
Point curr = new Point(0, 0);
int lowest = 0;
int highest = 0;
int farthest = 0;
int indi=0;
for(int i=0... |
18de6ccd-3623-4207-89ae-d75697d17fc4 | 0 | public int getRandomNumber(int min, int max) {
return (int) Math.floor(Math.random() * (max - min + 1)) + min;
} |
5735480e-0b2c-4698-9ec1-c63c20b09e28 | 3 | public Component getNewRuleComponent(Rule rule)
{
if(rule instanceof PrioritizedConditionalRule)
return new PrioritizedConditionalRulePanel((PrioritizedConditionalRule) rule, this);
else if(rule instanceof ConditionalRule)
return new ConditionalRulePanel((ConditionalRule) rule, this);
else if(... |
fa597851-3891-4e94-a8df-fa2022081d4f | 3 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String[][] courses;
sAct.getColumns();
for(int i = 0; i < sAct.getColumns(); i++)
{
String rButton = request.getParameter("pre... |
e267483a-399a-4d3b-93b1-b18e8b591991 | 8 | public void step() {
Color [][] nextCellGrid = new Color[rows][rows]; // stores grid of next generation of cells
for(int row = 0; row < rows; row++) {
for(int column = 0; column < rows; column++) {
int neighbors = getNeighbors(row,column);
if((neighbors <= 1 || neighbors >= 4) && isAlive(row,co... |
82a3629c-7bb0-4e7d-ad37-ac4630d63faa | 6 | public String[] getDependenciesPath(String dependencyPathString) {
if (dependencyPathString != null) {
String[] dirs = this.getSourceBase();
if (dirs.length == 1) {
if (this.isAssumeFilesExist()) {
String path = dirs[0] + dependencyPathString;
helpingMap.put(path, null);
... |
44323a10-d579-4e1b-bad1-5b2da4da82b0 | 9 | final private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos... |
9ad92dd1-f572-475b-8db7-39e5e50bcd37 | 1 | public void addField(FieldTracking field) {
if (this.fields == null) {
this.fields = new ArrayList<FieldTracking>();
this.fields.add(field);
} else {
this.fields.add(field);
}
} |
ffa460ad-5ceb-46d5-ab0d-c992adcab0f0 | 5 | private boolean versionCheck(String title) {
if (this.type != UpdateType.NO_VERSION_CHECK) {
final String localVersion = this.plugin.getDescription().getVersion();
if (title.split(delimiter).length == 2) {
final String remoteVersion = title.split(delimiter)[1].split(" ")[... |
de989b4b-c7c0-4bbe-bbc7-d4a62d1b9425 | 5 | public ArrayList<ArrayList<ArrayList<String>>> erstelleDutyelementListRegular(
ArrayList<Dienstplan> dienstplanliste, Fahrplan fahrplan) {
ArrayList<ArrayList<ArrayList<String>>> ListPlaeneGesamt = new ArrayList<ArrayList<ArrayList<String>>>();
int zaehler = 0;
ArrayList<Dutyelement> dutyelementlist = new Ar... |
8ea10717-6841-4a5d-b376-36cdec863dcf | 1 | public static void main(String[] args){
System.out.println("Hello World");
String s ="aab";
List<List<String>> result = new ArrayList<List<String>>();
result = new Palindrome_Partitioning().partition(s);
for(int i = 0 ; i< result.size();i++)
System.out.println(Arrays.... |
6dac34ef-8378-464b-9bdc-ccb33a4f227d | 1 | private boolean shouldTakeBasedOnScore(float currentScore, float mle, float maxScore, float stdev){
// based on number of bowls remaining to pass you, decide if you should take
if (currentScore < mle) return false;
float diff = maxScore - mle;
float percentage = 0.1f; // OPTIMIZE THIS NUMBER!!!
floa... |
82a2e2a7-ceb1-4659-ac84-32161462ff5b | 8 | public char[] getCloseParams()
{
char[] close_params = new char[66];
Double[] payed = new Double[]{0.0, 0.0, 0.0, 0.0};
System.out.println(this.payed.size());
for (int i = 0; i < payed.length; i++)
payed[i] = this.payed.get(i) * 100;
char[] cash_array = Convert.... |
7a835411-2765-4e78-a566-3754735e394f | 1 | public Sprite(TextureLoader loader, String ref) {
try {
texture = loader.getTexture("sprites/" + ref);
width = texture.getImageWidth();
height = texture.getImageHeight();
} catch (IOException ioe) {
ioe.printStackTrace();
System.exit(-1);
}
} |
e4e7f5c4-2fdd-407e-a254-fd2cbe02e55b | 9 | private void accumulatorCheckpointHelper(final TransactionStatus start, final long timestamp)
throws RetryException, InterruptedException {
for (TransactionStatus status = start; status != null; status = status.getNext()) {
final long tc = status.getTc();
if (tc > 0 && tc != ... |
d2f86098-7d7f-45a8-aed9-fb9ec62718d0 | 2 | public int writeMemory(int address,int value){
if(address>=0&&address<65536){
memnc[address]=value;
System.out.println("memnc["+address+"] =" + memnc[address]);
return 1;}
else return 0;
} |
34665924-7f00-4313-86d0-10125e9296bb | 8 | public Node<Integer> addHelper(Node<Integer> head1, Node<Integer> head2) {
if (head1 == null && head2 == null)
return null;
int sum = 0;
if (head1 != null)
sum += head1.data;
if (head2 != null)
sum += head2.data;
Node<Integer> next1 = (head1 == null) ? null : head1.next;
Node<Integer> next2 = (head... |
3a522240-b0c4-4daa-9319-076576be8c62 | 3 | public static List<UserMovie> readData(String filename){
List<UserMovie> list = new ArrayList<UserMovie>();
File file = new File(filename);
FileReader fr;
BufferedReader br;
String line;
String strs[];
try {
fr = new FileReader(file);
br = new BufferedReader(fr);
while(br.ready()) {
line = br... |
6b4bf15f-c3d7-4869-99d2-c7bdea3f985a | 2 | @Test
public void create() throws DBUpdateTimestampInvalidException {
try {
for (String name : samples) {
DBUpdateTimestamp ts = new DBUpdateTimestamp(name);
assertNotNull(ts);
}
} catch (DBUpdateTimestampInvalidException e) {
fail();
}
} |
32ce12b1-0462-4980-b54a-dbd45dbde373 | 3 | public static void bfs(int root) {
Queue<Integer> q = new LinkedList<Integer>();
q.add(root);
v[root] = true;
while (!q.isEmpty()) {
int node = q.poll();
for (int i = 0; i < G[node].size(); i++) {
Edge nodde = G[node].get(i);
int neigh = nodde.to;
if (!v[neigh]) {
v[neigh] = true;
T[... |
82cc75b8-b597-4562-8143-b10560ef5897 | 8 | private static void signGraph() {
Sign signer = new Sign();
System.out
.println("In order to sign a graph, you must first specicy some parameters.");
String inputGraph = getStringValue("Please specify the filename of the graph to be signed:");
GraphCollection gc = null;
try {
gc = TriGPlusReader.read... |
3e428c90-32b2-4130-a820-03eadc88b79b | 2 | private static ArrayList<TreeContainerRow> getContainers(ArrayList<TreeRow> rows) {
ArrayList<TreeContainerRow> containers = new ArrayList<>();
for (TreeRow row : new TreeRowIterator(rows)) {
if (row instanceof TreeContainerRow) {
containers.add((TreeContainerRow) row);
}
}
return containers;
} |
1e7178b7-4d48-4b9e-b397-82847089eff7 | 8 | public void render() {
Main.m.modeler.clearRGBAOffset();
if (doesDash && attacking && dashCharge == -1) {
forward = attackForward;
double savex = posX;
double savey = posY;
for (int i = 0; i < dashEffect.size(); i++) {
Double[] ghost = dashEffect.get(i);
posX = ghost[0];
posY = ghost[1];
... |
6fafef0d-112e-4930-b2db-77168f522b8a | 5 | @Override
public void executeTask() {
try {
DatagramSocket socket = new DatagramSocket(4111); // UDP socket to
// listen on,
while (true) // forever
{
try {
System.out.println("Waiting server file request");
byte[] recBuffer = new byte[15000];
DatagramPacket packet = new ... |
1c7d6d37-2d67-442d-b764-d93b44e2ee0d | 0 | public String getNomcommercial() {
return nomcommercial;
} |
20a61f25-afaf-4839-8026-8fc6f8abf58e | 6 | void drawPlayerArrows(Graphics g)
{
//if(_y==100)
if(_y==500/_arrows.length)
{
allOneDown();
nextArrows();
//initData();
}
for(int y=0;y<_arrows.length;y++)
for(int x=0;x<_arrows[0].length;x++)
if(_arrows[y][x]!=null)
{
if(y==_arrows.length-1)
drawGlow(g,x);
g.drawI... |
6f442f23-63dd-416b-9c77-1e3a99f8f25b | 6 | Verzameling doorsnede(Verzameling V) {
for(int i = 0; i < elementen.length; i++)
for(int j = 0; j < elementen.length; j++)
if(elementen[i] == V.elementen[j])
aantal++;
doorsnedeArray = new int[aantal];
for(int i = 0; i < elementen.length; i++) {
for(int j = 0; j < elementen.length; j++) {
i... |
2d7ec632-b101-4175-8718-5b8d31dafb9f | 9 | public void run() {
if (!arena.isIngame()) {
sender.sendMessage(OITG.prefix + "The round has not yet started in that arena.");
return;
}
int pageNum = -1, pageMax = (int) Math.ceil(arena.getPlayerCount() / 10.0);
if (args.length > 1) {
try {
... |
3e5eff9b-44d4-4fe6-948b-58e48bc8d209 | 8 | public String convertToNotation() {
String letter = "";
switch(col) {
case 0:
letter="A";
break;
case 1:
letter="B";
break;
case 2:
letter="C";
break;
case 3:
letter="D";
break;
case 4:
letter="E";
break;
case 5:
letter="F";
break;
case 6:
letter="G";
br... |
dfd5493f-ea30-47af-aac4-336d4d353f2a | 4 | public static Element childsTag(Element element, String tag)
{
NodeList nl = element.getChildNodes();
if (nl != null)
{
int length = nl.getLength();
boolean has = false;
for (int i = 0; (i < length) && !has; i++)
{
has = (nl.item(i)).getNodeName().equals(tag);
if (has)
{
return (E... |
97010d4b-4b7c-4911-aae7-073c2937fb5b | 1 | private <K,V> Map<K,V> createMap(Comparator<K> comparator)
{
Map<K,V> rs;
if(comparator != null)
{
rs = new TreeMap<K,V>(comparator);
}
else
{
rs = new HashMap<K,V>();
}
//Map<K,V> rs = comparator != null ? new TreeMap<K,V>(comparator) : new HashMap<K,V>();
return rs;
} |
944d03fe-f61f-46ea-8abd-cfdf7748acb6 | 9 | public boolean cantarVale4(){
if((this.getCartas()[0].getValor() > 10)&&(this.getCartas()[1].getValor() > 10)){
return true;
}else if((this.getCartas()[1].getValor() > 10)&&(this.getCartas()[2].getValor() > 10)){
return true;
}else if((this.getCartas()[0].getValor() > 10)&&(this.getCartas()[2].getValor() > ... |
c9577646-3f14-4776-a69d-d9d63fbc04c7 | 8 | public NodoLista proximoNodo() {
// si no hay un iterador o ya no hay mas elementos en el actual
if (iterador == null || iterador.proximoNodo() == null) {
// todavia hay elementos
if (i < TAMANO_T && contadorAux < contadorRegistros) {
do {
i++; // busca una posicion que tenga alguna lista
... |
41e6c340-52b7-444e-ab23-d29d0a258c1d | 8 | private ConsoleRummy()
{
game_joker = null;
FileInputStream f = null;
input = new Scanner(System.in);
try
{
current_player = new Player();
prop = new Properties();
f = new FileInputStream(state_file);
prop.loadFromXML(f);
current_player.setName(prop.getProperty("user"));
String url_str = ... |
94d913cc-3f35-40a2-b495-c9c62b7464fa | 2 | @RequestMapping({ "/getImagemProduto" })
@ResponseBody
public byte[] getImagemProduto(Long idProduto) {
byte[] image = null;
Produto produto = produtoDao.findById(idProduto);
if (produto != null && produto.getImagem() != null) {
image = produto.getImagem();
}
return image;
} |
ddc2e80a-1665-4643-b350-17f6d6b0d0b9 | 3 | public static PathwayElement createGraphicalLine(
List<Double> mPointsDoubles, double relX, double relY, String startGraphRef,
String endGraphRef, String pointGraphId, String arrowHead, List<String> anchorList,
Color color, int lnThickness, int lineStyle, String connectorType,
int zOrder, String groupRef, L... |
838fde52-4974-463e-a432-138c76db6420 | 2 | @Override
public int compareTo(nodoBusqueda arg0) {
if (getMovimiento().getDistancia() < arg0.getMovimiento().getDistancia())
{
return -1;
}else if (getMovimiento().getDistancia() > arg0.getMovimiento().getDistancia())
{
return 1;
}
return 0;
} |
1bcaf54e-53dd-458c-b8f1-5731535c0d1c | 7 | public List<IRowId<?,?>> combine(String query) throws Exception {
HQuery hquery = HQueryParser.parse(query);
List<IFederatedSource> sources = new ArrayList<IFederatedSource>();
List<HTerm> terms = new ArrayList<HQuery.HTerm>();
HQuery.toTerms(hquery, terms);
for (HTerm aTerm : terms) {
IFederatedSou... |
822875ab-7447-499b-a6a3-b3b118dda5fd | 7 | public ArrayList<Boolean> cantoReTruco(){
ArrayList<Boolean> respuesta = new ArrayList<Boolean>();
boolean resp = false;
int respNum = 0;
boolean vale4 = false;
boolean error = true;
while(error){
Scanner sc = new Scanner(System.in);
try{
System.out.print("\n1-Quiero -- 2-No Quiero -- 3-QUI... |
af25faaa-aa6e-4388-9983-080ad2210fea | 9 | public boolean isBlocked(Location l, boolean playersBlock){
if (playersBlock)
{
//Return true if occupied by any player
for (Player player : players)
{
if (l.equals(player.getLocation()))
return true;
}
}
//Return true if the location is beyond the edge of the map
if(l.getX() >= MAX_X ||... |
0bfffe05-8547-4c6d-a994-341fe9cf13cd | 4 | public void addSchedulJobToTable(SchedulJob job) {
try {
Object[] x = new Object[7];
x[0] = job.getSchedulID();
x[1] = job.getStreamID();
x[2] = job.isJobenabled() ;
x[3] = controlStreams.getStreamByID(job.getStreamID()).name;
//only show the time, if this is not a Job, which starts at the start of ... |
89382207-45a8-4602-96f8-5c71b3a750f4 | 6 | private String getStringByLeftState(String state, String topOrBottom) {
String fullRow = "";
if (topOrBottom.equals("top")) {
int index = topOfTableRow.indexOf(state);
if (index == -1 ) return "";
ArrayList<Boolean> row = topTable.get(index);
for (Boolean rowItem : row ) {
... |
82ffefdc-1dc1-4bb4-b285-cb22aa5f444d | 8 | @Override
public void actionPerformed(ActionEvent arg0) {
if (players.get(0).getHealth() <= 0) {
lose();
}
timeElapsed++;
// moving mobs is synced with timer
moveOffset++;
if (moveOffset > 75) {
currentMap.moveMobs();
moveOffset = 0;
}
// spawning is synced~~~~~~~~~~
spawn... |
cea0a0c9-4110-47b1-b182-9d6e1614ce77 | 8 | private void createNetwork(int[] layers){
//Network must have at least one layer
assert(layers != null && layers.length != 0);
input_nodes = layers[0];
//Create nodes for each layer
for (int i=0, count; i<layers.length; i++){
count = layers[i];
//Layers must have positive node count
assert(count >... |
06b525ab-589e-40e5-b159-472a6fd6dd78 | 0 | public Employee(int b) {
effectivenessMultiplier = 1;
baseWeeklySalary = b;
totalPaymentToDate=0;
} |
dd38787d-b185-46da-8d0b-5ca8ad8bd926 | 0 | public Color getColor() {
return color;
} |
12a3e579-f342-49ce-9a28-ab933a8e4176 | 8 | private void calculateMinMargin(Double fieldA) {
if((ourProportion.compareTo(fieldA) <= 0) && ((purchaseCost.compareTo(0.0) != 0) ? minMarginOnPosition.compareTo((minCostOnAll - 0.02) / purchaseCost * 100.0 - 100.0) < 0 : minMarginOnPosition.compareTo(0.0) < 0)) {
if(settlementCost.compareTo(0.0) !=... |
78ee9a60-33c4-4162-92d7-5b037e51341b | 0 | @Override
public void setCommand(String command) {
this.command = command;
} |
64264f60-13ac-4e73-b4cf-04c4f83bbc1c | 3 | public String loadDocumentURL(int docId)
{
String docurl = "";
String strStatement = "SELECT dOriginalName FROM document AS d WHERE d.dID = " + docId;
ResultSet rstResultSet = null;
try
{
rstResultSet = startQuery(strStatement);
if (rstResultSet.next())
{
docurl = rstResultSet.getString("d.dOrig... |
1aa7f21e-d8e3-4aac-81f4-3c2103bf3a5c | 6 | public static List<Integer> GetPrimes(int max) {
boolean[] workingSet = new boolean[max + 1];
for (int i = 2; i < workingSet.length; i++) {
workingSet[i] = true;
}
int p = 2;
while (p * p <= max) {
int j = p * p;
while (j <= max) {
... |
b960c7b7-a0ea-4bd2-b1af-4ec6af3cfc32 | 8 | @Test
public void testEachWallForItem(){
//make sure each wall is given only one item (including the ceiling)
//in a room, a floor must contain AT LEAST one item
RoomFactory factory = new RoomFactory();
for (int i = 0; i < 100; i++){
Room room = new Room("");
int north = 0;
int south = 0;
int east ... |
65ae6b22-bddf-4162-aec0-643449927235 | 6 | public void set(String key, int ttlSec, Object value, long timeoutMiliSec)
throws TimeoutException, MemcachedException {
try {
StringBuilder sb = new StringBuilder();
byte valueBytes[] = null;
int flag = -1;
if (value instanceof String) {
String arg = (String) value;
valueBytes = arg.getByte... |
2b9f42e9-560a-4026-bb6d-f1453e8c0543 | 7 | public void keyPressed(KeyEvent e) {
MazewarPacket packetToOthers = new MazewarPacket();
packetToOthers.name = name;
// If the user pressed Q, invoke the cleanup code and quit.
if((e.getKeyChar() == 'q') || (e.getKeyChar() == 'Q')) {
... |
7835bc7f-56bc-4b4c-9d7f-a52ddd0501b1 | 1 | public ErrorMessage getError() {
if (hasError()) {
return (ErrorMessage) value;
} else {
return ErrorMessage.NO_ERROR;
}
} |
2c9ce64b-1177-415d-895b-57c92a383557 | 8 | @Override
public void run() {
while (true) {
MessageQ.Message message = messageQ.poll();
String[] reqSplit = message.getRequest().split("-");
if (reqSplit[0].equals("LOGIN")) {
if (loggedInIndex(reqSplit[1]) == -1 && login(reqSplit[1], reqSplit[2])) {
... |
da1a3814-6704-45ed-a8fb-cbd415231438 | 5 | public City getCity(int id) {
City cit = null;
Connection con = null;
Statement stmt = null;
try {
DBconnection dbCon = new DBconnection();
Class.forName(dbCon.getJDBC_DRIVER());
con = DriverManager.getConnection(dbCon.getDATABASE_URL(),
... |
db89c1ec-9377-4ed4-b91a-c27a7f97c4ba | 2 | public void toggleQ5()
{
if (Q5Associated.equals(true))
{
pumpCommandQuicImage.updateImage("src/com/anakena/freePcaInterlock/Q5InactiveQUIC.png");
pumpCommandPanel.updateValue("X");
Q5Associated = false;
}
else if (Q5Associated.equals(false))
{
pumpCommandQuicImage.updateImage("src/com/anakena/fr... |
385f95a4-fcdd-4fcd-beb6-d4a3f79c8f36 | 7 | protected static Ptg calcErrorType( Ptg[] operands )
{
Object o = operands[0].getValue();
String s = o.toString();
if( s.equalsIgnoreCase( "#NULL!" ) )
{
return new PtgInt( 1 );
}
if( s.equalsIgnoreCase( "#DIV/0!" ) )
{
return new PtgInt( 2 );
}
if( s.equalsIgnoreCase( "#VALUE!" ) )
{
retu... |
650aed1a-5b1d-48b4-a098-a405bb70288a | 1 | public static void runFile(File file) {
JSScriptInfo info = JSScriptInfo.LoadScriptFromFile(file);
if (info != null) {
info.Run();
}
} |
53ba9128-b73f-4a7e-9d5c-c47d2565e873 | 6 | public LinkedList<E> findPathAvoiding(E fromE, E toE, E avoidE) {
clearState();
Node<E> fromNode = findNode(fromE);
Node<E> toNode = findNode(toE);
Node<E> avoidNode = findNode(avoidE);
if(avoidE != null) avoidNode.visited = true;
LinkedList<E> pathList = new LinkedList<E>();
Queue<Node<E>> toDoList = n... |
49b7b9d6-9259-4c51-b44f-8bcafad459db | 5 | public static ImageIcon generateThumbnail(LibraryModel lmodel) throws IOException
{
Log.i("Generating thumbnail for "+lmodel.info.name+" ("+lmodel.info.author+")");
Model model = lmodel.model;
if (model == null)
{
lmodel.load();
model = lmodel.model;
lmodel.unload();
}
... |
38a0eaa5-a1e6-4dcb-9a5a-062d0886d956 | 7 | public int tokenType() {
if (tokenizer.ttype == StreamTokenizer.TT_WORD) {
if (tokenizer.ttype == '"') { // a quoted string
return STRING_CONST;
} else if (checkKeyword() != -1) {
return KEYWORD;
} else if (Character.isDigit(tokenizer.sval.charAt(0))) {
return INT_CONST;
}
return IDENTIFIER... |
12ca6611-340a-4761-a2b0-9d6de8110a9e | 2 | public void testGetValue_int() {
LocalDate test = new LocalDate();
assertEquals(1970, test.getValue(0));
assertEquals(6, test.getValue(1));
assertEquals(9, test.getValue(2));
try {
test.getValue(-1);
} catch (IndexOutOfBoundsException ex) {}
try {
... |
4a46a2db-e00e-4817-aa07-5b7df83b8cca | 1 | public void testToStandardSeconds() {
Weeks test = Weeks.weeks(2);
Seconds expected = Seconds.seconds(2 * 7 * 24 * 60 * 60);
assertEquals(expected, test.toStandardSeconds());
try {
Weeks.MAX_VALUE.toStandardSeconds();
fail();
} catch (ArithmeticEx... |
7f6fd38d-9527-439d-8721-8121f2a08cf9 | 9 | private String getAttributeValue2(String attributeName){
tag = tag.trim();
if (tag.contains((CharSequence) " ")==false){
return tag;
}
String orgTag = tag;
tag = tag.substring(tag.ind... |
61cad2d7-1e2f-4333-97d6-75c78396fc15 | 4 | public boolean handleFirstExpression(Expr expr1, Expr expr2){
if (expr1 instanceof LogicalExpr){
Expr lhs1 = ((LogicalExpr) expr1).getLHS();
Expr rhs1 = ((LogicalExpr) expr1).getRHS();
String op1 = ((LogicalExpr) expr1).getOperator();
if (op1.equals("and")){
return handleFirstExpression(lhs1, expr... |
b9037bb7-4516-4733-9027-bd1b63222e39 | 3 | @Override
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
DatabaseManager manager=DatabaseManager.getManager();
try {
ServletResult.sendResult(response, manager.getEquipmentDao()
.deleteById(Integer.parseInt(request.getParameter(ID)))==1 ?
... |
537a456b-283c-4645-a42d-4d4d4a288fa9 | 2 | public boolean isCharged()
{
char orbital = getOrbitalLetter();
if(orbital == 'd' || orbital == 'f')
return false;
return true;
} |
c2403f83-a12f-4fa7-81e1-843aa4643d47 | 9 | protected String getClientGroups(String id, String password)
{
String groupList = "";
try
{
File fXmlFile = new File("server.xml");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder;
dBuilder = dbFactory.newDocumentBuilder();
Document doc = null;
... |
9b7dbc4b-9287-4d9c-a814-1fe2ed04946a | 0 | @Override
public String toString() {
return "Vec2f[x=" + x + ", y=" + y + "]";
} |
ee2ad82b-b2a9-4247-a5d1-5751bf3d111b | 5 | public void testGetGafs() {
System.out.println("\n**** testGetGafs ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CONNECTION) {
... |
952157f8-94dd-4d64-8e34-b048a9c51703 | 2 | public String buscarUsuariosPorNombre(String name){
String cadena;
String resultBusqueda = "No se encuentra registro";
tablaDeUsuarios();
cadena = name.substring(0,1).toUpperCase() + name.substring(1, name.length());
for(int i = 0; i<data.size();i++){
String NombreBus... |
19eeb07c-e139-496f-b757-0207bd5edc22 | 8 | public static void updateTiles() {
for(int i=0;i<tiles.length;i++) {
if(tiles[i] != null) {
if(tileTypeList.get(tiles[i]) == "Blank") {
tileImageList.put(tiles[i], ImageLoader.blank);
}
if(tileTypeList.get(tiles[i]) == "Field") {
tileImageList.put(tiles[i], ImageLoader.field);
}
if(ti... |
4d2d1076-60ab-4053-b2ab-c90866e4ea80 | 4 | private void setupValidItemSpawnLocations() {
for (int x = 0; x < tiledMap.getWidth(); x++) {
for (int y = 0; y < tiledMap.getHeight(); y++) {
if (!blockedForHero(x, y) && blockedForTowers(x, y)) {
validItemSpawnLocations.add(new Point(x, y));
}
}
}
} |
b2be4758-a818-4076-b549-0591d6746b9b | 6 | private Window()
{
baseFrame = new JFrame("TEST");
baseFrame.setLayout(new GridBagLayout());
baseFrame.setSize(200, 300);
baseFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
baseFrame.addWindowListener(new WindowListener(){
@Override
public void windowActivated(WindowEvent arg0)
{
}
... |
f1e9c9f2-84b8-4ecf-a5df-26a2b701050e | 9 | public boolean execute() {
final int cycle=CDState.getCycle();
if( shuffle ) rperm.reset( Network.size() );
for(int j=0; j<Network.size(); ++j)
{
Node node = null;
if( getpair_rand )
node = Network.get(CDState.r.nextInt(Network.size()));
else if( shuffle )
node = Network.get(rperm.next());
else
no... |
8dd2c0c3-93b1-4ee0-a260-3f434ad5e19e | 4 | private void redrawBoard() {
boardImage = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g = boardImage.createGraphics();
g.setColor(Color.WHITE);
g.fillRect(0, 0, imageWidth, imageHeight);
g.setColor(BOARD_COLOR);
g.fillRect(round(offsetX), round(offsetY), boardWidth, b... |
af875a66-1548-4ce5-8a6f-cc4405140967 | 4 | public int read(byte[] samples, int offset, int length)
throws IOException
{
// read and filter the sound samples in the stream
int bytesRead = super.read(samples, offset, length);
if (bytesRead > 0) {
soundFilter.filter(samples, offset, bytesRead);
return byt... |
5f488ab7-1d2a-4763-a488-65a890c0b68b | 8 | private boolean check() {
if (N == 0) {
if (first != null)
return false;
} else if (N == 1) {
if (first == null)
return false;
if (first.next != null)
return false;
} else {
if (first.next == null)
return false;
}
// check internal consistency of instance variable N
int numberOf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.