method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
9b55a9f3-17fe-4f4e-95c1-9d8f754900d1 | 5 | private Matrix normal(Matrix mat) {
Matrix globalMat = new Matrix(new double[mat.numRows()][mat.numColumns()]);
for(int term = 0; term < mat.numColumns(); term++) {
double norm = 0;
for(int doc = 0; doc < mat.numRows(); doc++) {
double tf = mat.m[doc][term];
if (tf > 0) {
n... |
1021c252-381a-4bc8-bdc2-e719d111be22 | 3 | public void setEqualizer(Equalizer eq)
{
if (eq==null)
eq = Equalizer.PASS_THRU_EQ;
equalizer.setFrom(eq);
float[] factors = equalizer.getBandFactors();
if (filter1!=null)
filter1.setEQ(factors);
if (filter2!=null)
filter2.setEQ(factors);
} |
ddd45d0e-8098-4288-86c3-a614faf236a2 | 9 | @Override
public Query rewrite(IndexReader reader) throws IOException {
final Term[] terms = phraseQuery.getTerms();
final int[] positions = phraseQuery.getPositions();
boolean isOptimizable = phraseQuery.getSlop() == 0
&& n >= 2 // non-overlap n-gram cannot be optimized
&& terms.length >... |
c11d656a-2dcd-4d04-bec0-45d999f1f671 | 8 | private void fireBullets(List<BulletCommand> bulletCommands) {
BulletPeer newBullet = null;
for (BulletCommand bulletCmd : bulletCommands) {
if (Double.isNaN(bulletCmd.getPower())) {
println("SYSTEM: You cannot call fire(NaN)");
continue;
}
if (gunHeat > 0 || energy == 0) {
return;
}
do... |
5da21e4a-2aa9-45c2-9ee4-567d7bf00732 | 5 | @Override
public List<FoodCombo> getCurrentMenuChoices() throws RuntimeException {
List<FoodCombo> items = new ArrayList<FoodCombo>();
try {
// Make sure you always open a connection before trying to
// send commands to the database.
db.openConnection... |
e0c2fcd8-6f23-41d1-bb36-cb6f07e4c6b4 | 4 | public String selectFile(int mode) {
String returnVal = null;
int ret = 0;
final JFileChooser fc = new JFileChooser();
JFrame frame = new JFrame("FileChooser");
//show open or save dialog
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
if(mode == MODE_OPEN)
{
ret = fc.sh... |
0a7f7054-c5d6-400b-8f96-54381cb87446 | 4 | private void initComponents()
{
this.setLayout(new GridLayout(3,1));
WinchPanel = new JPanel();
WinchPanel.setLayout(new GridLayout(1,2));
WinchPanel.setBackground(Color.WHITE);
DrumPanel = new JPanel();
DrumPanel.setLayout(new GridLayout(1,2));
DrumPanel.setB... |
00252fe8-54e3-4d84-85cd-60d6bf380139 | 6 | private void buildItemData( VgerItemData theItem, Document output,
Element element )
{
Element itemNode;
itemNode = output.createElement( "Item" );
if ( theItem.getBarcode() != null )
itemNode.appendChild( makeTextNode( "ItemNumber",
... |
76ef3484-95fd-42ae-8183-ad7c3d95f054 | 7 | public static float[] rref2(float[] matrix, int matrixSize){
int i = 0;
int j = 0;
for(;j < matrixSize; j++){
float lastValue = 0;
int largestRow = i;
for(int k = i; k < matrixSize; k++){
final int pos = getPosistion(k, j, matrixSize+1);
if(Math.abs(matrix[pos]) > lastValue){
lastV... |
e4f13ecf-8577-4611-aac7-c00484a436f7 | 0 | public ThreadPoolScheduler() {
String threads = System.getProperty("junit.parallel.threads", "16");
int numThreads = Integer.parseInt(threads);
executor = Executors.newFixedThreadPool(numThreads);
} |
8dd009f5-28d8-412b-a4ce-9e58f054f22a | 4 | public void setNeighbors(){
for(int i = 0; i < gameBoard.length; i++){
for(int j = 0; j < gameBoard[i].length; j++){
if(j - 1 >= 0){
gameBoard[i][j].addNeighbor(gameBoard[(i+1)%12][(j+3)%4]);
gameBoard[i][j].a... |
8dd210ad-997b-47f3-8b47-e4448a01a872 | 0 | public void remindBuyerMarkReceived(Auction auction){
auction.remindBuyerMarkReceived();
} |
a640ace8-52c8-4409-a188-1993ac1c2eca | 9 | public static void main(String[] args) throws InterruptedException {
if(!(args.length == 2 || (args.length == 3 && args[0].matches("-speedup|-scaleup")))) {
System.out.println("Usage: java BruteForceDES [-scaleup|-speedup] t s");
System.out.println(" t number of threads control");
... |
59f0d92d-6281-4d2e-aa5a-5c6fec340d95 | 0 | @After
public void tearDown()
throws Exception
{
this.scheduler.shutdown();
} |
8804e21c-5ee9-47c2-b675-25088bbc0f08 | 8 | public void setEtat (int etat){
super.setEtat(etat);
switch (etat) {
case initiale: {
initSources();
btnEnregistrerOuvrage.setEnabled(true);
textFieldTitre.setEnabled(true);
textFieldIsbn.setEnabled(true);
textFieldDateEd.setEnabled(true);
textFieldEditeur.setEnabled(true);
btnAnnulerOuvrage.... |
b66011ee-4e74-4a2d-adb0-d69bcc47b849 | 0 | public String getCity() {
return city;
} |
d4ed90e4-7046-4fb7-bc0a-0aa29218ffd1 | 7 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
for (String line; (line = in.readLine())!=null; ) {
if(line.equals("*"))break;
char[] txt=line.toCharArray();
int q = Integer.parseInt... |
d38a47dd-cab3-4786-869d-99ea219c400e | 4 | public static int createDisplayList(Model m) {
int displayList = glGenLists(1);
glNewList(displayList, GL_COMPILE);
{
glMaterialf(GL_FRONT, GL_SHININESS, 120);
glColor3f(0.4f, 0.27f, 0.17f);
glBegin(GL_TRIANGLES);
for (Model.Face face : m.getFaces(... |
24a2c865-5e5a-4963-8ac4-b093a7188386 | 3 | public String next() {
String url = null;
Node parent = current.getParent();
if (parent != null) {
int lenght = current.subNode.size();
Node next = null;
for (int i = 0; i < lenght; i++) {
if (current.getURL().equals(next = current.subNode.get(i))) {
return next.getURL();
}
}
} else {... |
c4c66dee-2067-443b-803c-a16d6b70b99e | 0 | public static void runEditorFrame(){
editorFrame = new EditorFrame();
editorFrame.setVisible(true);
} |
d2c56c98-b1d3-4364-badc-25ce545b69f6 | 3 | private void VoltarMenuPrincipal_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VoltarMenuPrincipal_ButtonActionPerformed
if ("Visitante".equals(a.getTipoUtilizador())) {
new Visitante(a);
}
if ("Gestor".equals(a.getTipoUtilizador())) {
new Gesto... |
253d92e5-037b-4990-b842-c6ed8f248148 | 2 | @Override
public void run()
{
String msg = input.nextLine();
while (!msg.equals(ProtocolStrings.STOP))
{
notifyListeners(msg);
msg = input.nextLine();
}
try
{
socket.close();
} catch (IOException ex)
{
... |
9b45cf8b-3a22-40e6-ae7e-61e613179ab6 | 1 | public void fixObjects() {
baseGenome = bestVariation;
bestVariation = null;
for (LabelGene gene : baseGenome) {
avoids = avoids.union(gene.getGeometry());
gene.render();
}
baseGenome = new LabeledGenome<LabelGene>(avoids);
} |
0624171b-6f5b-4b3a-bd91-d2c77d122ce4 | 7 | public ArrayList<Integer> findSubstring(String S, String[] L) {
// Start typing your Java solution below
// DO NOT write main() function
int n = S.length();
int m = L.length;
ArrayList<Integer> res = new ArrayList<Integer>();
if (n == 0 || m == 0)
return res;
int perLen = L[0].length();
int length = ... |
300f38f0-604b-458d-a19e-3c9439fdd47a | 5 | public MyGeneralTree<String> createGeneralTree(List<String> nodeDescriptors)
{
if(nodeDescriptors == null || nodeDescriptors.size() == 0)
return null;
NodeDescriptor rootDescriptor = null;
List<NodeDescriptor> nodeDescriptorList = new ArrayList<>();
for(String n... |
d003339b-464a-423d-991d-0b9f10b21ede | 6 | @Override
public void update() {
if (rectangles.get(0)
.contains(InputHandler.instance.getMouseLocation()) && !drawAll) {
inactiveTimer.reset();
drawAll = true;
}
if ((InputHandler.instance.getMouseButton() == MouseEvent.BUTTON2)
&& (InputHandler.instance.getMouseButtonRotation() != 0)) {
Syste... |
e2c0c76c-17af-493e-b001-2923df6a3271 | 2 | public void printCycle(int cycleIndex, Main m){
int[] temp = cycles.get(cycleIndex);
System.out.printf("\t Cycle %d:\n", cycleIndex);
for(int i=0; i<temp.length; i++){
if(graphNodes.get(temp[i]).getType()== _REACTION_){
System.out.printf("\t");
m.getReactions().get( graphNode... |
10333af4-d04d-4e3a-95db-92967695caf1 | 5 | @Override
public boolean state() {
if (this.ticksHeld == 0) {
return false;
}
if (this.ticksHeld == 1) {
return true;
}
if (this.ticksHeld < this.initialDelay) {
return false;
}
if (this.ticksHeld == this.initialDelay) {
return true;
}
if ((this.ticksHeld - this.initialDelay) % this.repea... |
c5ce1cba-9fb9-4487-bf71-ae8e21d61cb1 | 8 | public void testPingPong () throws IOException {
fail = null;
final Data dataTCP = new Data();
populateData(dataTCP, true);
final Data dataUDP = new Data();
populateData(dataUDP, false);
final Server server = new Server(16384, 8192);
register(server.getKryo());
startEndPoint(server);
server.bind(tcp... |
27e6cb15-25f3-41a0-a548-72fa08e808ba | 8 | @Override
public void update(GameContainer gc, StateBasedGame sb, int delta)
throws SlickException {
for (MenuButton button : buttons) {
button.update(gc, sb, delta);
}
if (playButton.isMousePressed()) {
if (Game.app.getFPS() >= 30) {
if (firstTime) {
fillAlpha = 175;
firstTime =... |
92288e3d-8d54-49e3-b105-bbadfb4c37fb | 4 | public void drawTextualMap(){
for(int i=0; i<grid.length; i++){
for(int j=0; j<grid[0].length; j++){
if(grid[i][j] instanceof Room){
if(((Room)grid[i][j]).getItems().size()>0)
System.out.print(" I ");
else
System.out.print(" R ");
}else{
System.out.print(" = ");
}
}
... |
eb54c3fe-52f1-402c-a824-4a424cd6b308 | 6 | public boolean sendData(Object data) {
if (output == null || !clientSocket.isConnected()) {
return false;
}
synchronized (this) {
try {
output.flush();
output.writeObject(data);
output.flush();
output.reset(... |
57fd8e26-d79c-4412-bbf3-4ba5d90b222d | 0 | public int getLengthLifeInAquarium() {
return lengthLifeInAquarium;
} |
841d3023-14b5-4a4a-a28a-78e3014db0c2 | 9 | private void redoHelper(boolean fromNetwork) {
//get the top of the action stack, handle it, and push it to the past actions stack for undo
if(futureActions.empty()) {
System.out.println("no actions to redo!");
return;
}
if(!fromNetwork)
networking.sendAction(new BoardEltExchange(null, BoardActionType.... |
985b814d-e583-44c4-aeeb-2fa6a27011af | 5 | @Override
public void mousePressed(MouseEvent e) {
final TCard source = (TCard) e.getSource();
if (e.getButton() == MouseEvent.BUTTON1) {
tempCard = source;
tempX = e.getX();
tempY = e.getY();
cardPosition = source.getCardPosition();
if (e.... |
c799ab43-f36f-44bb-86d3-549fc22735aa | 9 | public boolean searchMatrix(int[][] matrix, int target) {
if (matrix.length == 1) {
for (int i=0; i<matrix[0].length; i++) {
if (matrix[0][i] == target)
return true;
}
return false;
}
for (int i=1; i<matrix.length; i++) {
... |
d91a1377-804c-4bbf-a71c-8767e2b72916 | 0 | public CATEGORY getCategory() {
return this.category;
} |
a6889ee1-18b9-40d5-aabf-7f9593e2d82f | 3 | public static boolean isFree(int x, int y) {
if (!inField(x, y) || !isFreeFromBricks(-1, x, y)
|| theField[x][y] == 2) {
return false;
}
return true;
} |
7db5f4fb-db07-450c-9a8e-1aaf07ec3371 | 1 | private void addRelativeMove(float x, float y) {
Coordinate lastCoordinates;
try {
lastCoordinates = coordinates.getLast();
} catch (NoSuchElementException e) {
lastCoordinates = new Coordinate(0, 0);
}
coordinates.add(new Coordinate(lastCoordinates.x+x, lastCoordinates.y+y));
} |
db5835ea-366b-49ee-ad60-651d57c9ecc6 | 7 | public static int LD (String s, String t) {
int d[][]; // matrix
int n; // length of s
int m; // length of t
int i; // iterates through s
int j; // iterates through t
char s_i; // ith character of s
char t_j; // jth character of t
int cost; // cost
// Step 1
n = s.length ();
m =... |
76d1d0b6-aae3-4b4e-b999-686ee82521a7 | 0 | protected final Logger getLogger() {
return LoggerFactory.getLogger(this.getClass());
} |
20aef808-3822-40ed-b71c-5f15b943b77f | 7 | public GeneralPath draw(Graphics2D g2,
Rectangle2D dataArea,
ValueAxis horizontalAxis, ValueAxis verticalAxis) {
GeneralPath generalPath = generateClipPath(
dataArea, horizontalAxis, verticalAxis
);
if (this.fillPath || this.dr... |
f9692426-2836-45a2-926c-2940576d8498 | 8 | @Override
public WindowsAttributes getWindowsAttributes(String path)
throws PathNotFoundException, AccessDeniedException,
UnsupportedFeatureException {
if (hardlinks)
{
//Get hard link paths
String[] hardlinks = getHardLinks(path);
if (hardlinks.length > 0)
path = hardlinks[0];
}
if (windows... |
b78547fc-b6ec-4cf7-a13b-16eb5d8072e0 | 0 | public void setContent(String content) {
mContent = content;
} |
845215c6-3670-44de-ab56-71499b16efad | 3 | @Override
public void run() {
init();
long start;
long elapsed;
long wait;
// game loop
while (running) {
start = System.nanoTime();
update();
draw();
drawToScreen();
elapsed = System.nanoTime() - start;
wait = targetTime - (elapsed / 1000000);
if (wait < 0) {
wait = 5;
}... |
16ff3e22-8a66-4236-ae2d-7d3207ab52e6 | 1 | public Def availDef(final Def def) {
final Def availDef = (Def) availDefs.get(def);
if (SSAPRE.DEBUG) {
System.out.println(" avail def for " + def + " is "
+ availDef);
}
return availDef;
} |
03903dc6-ac4e-4dd7-903d-65f2530a7263 | 5 | public void writeKnownAttributes(GrowableConstantPool gcp,
DataOutputStream output) throws IOException {
if (bytecode != null) {
output.writeShort(gcp.putUTF8("Code"));
output.writeInt(bytecode.getSize());
bytecode.write(gcp, output);
}
if (exceptions != null) {
int count = exceptions.length;
ou... |
734c9480-8e91-45bd-b77f-caf80c14e2a6 | 0 | public DocumentRepositoryListener[] getDocumentRepositoryListeners() {
return (DocumentRepositoryListener[]) documentRepositoryListeners.toArray();
} |
45f3e6d8-c268-4c61-9756-08d51352024c | 8 | public QryResult evaluateIndri(RetrievalModel r) throws IOException {
// Initialization
allocDaaTPtrs (r);
QryResult result = new QryResult ();
double queryVal = (double) 1 / (double)this.args.size(); // args / daat ?
boolean looper = true;
double tempScore = 0;
DaaTPtr ptri;
... |
fee3f6f3-d8dd-47b6-92c0-72b27ba5040b | 4 | public String peekUnsearchList(){
final String sql = "SELECT min(sn), url FROM WAIT_SEARCH_URL_WIKI";
String sn = "";
String url = "";
Statement stmt;
try {
stmt = this.connection.createStatement();
ResultSet rs = stmt.executeQuery(sql);
while (rs.next()) {
sn = rs.getString(1);
url = rs.getS... |
4c886501-8694-48c0-b908-4cd282e84778 | 6 | private void analyseLineFirstPass(String assemblyLine) throws AssemblerException {
if (assemblyLine.equals(".data")){
if(dataDeclared)
throw new AssemblerException(".data section already declared.");
dataDeclared = true;
atData = true;
atText = false;
}
else if (assemblyLine.equals(".t... |
b302d127-2dfc-4629-a9fa-9b4f9617af0a | 0 | public Distance distanceTo(Point second) {
double dx, dy, difference;
dx = x - second.x;
dy = y - second.y;
difference = Math.sqrt(dx * dx + dy * dy);
return new Distance(difference, unit);
}
}
/*
* Klasse voor een lijn. Bevat een twee punten en een meeteenheid
* Deze klasse erft alles van vorm
* Deze ... |
3d049f61-8a9f-4e87-af07-013db2ab219e | 6 | public static void nextPermutation(int[] num) {
int index = -1;
int swap = -1;
for (int i = num.length - 1; i > 0; i--) {
if (num[i - 1] < num[i]) { index = i - 1; break;}
}
if (-1 != index) {
for (int i = num.length - 1; i >= 0; i--) {
if (num[i] > num[index]) {swap = ... |
bae771bc-7608-4c56-9f4a-c7715ef15c9d | 1 | public static float sum(float[] arr){
float sum = 0;
for (int i = 0 ; i < arr.length; i++){
sum += arr[i];
}
return sum;
} |
87dfb3b7-0f50-4cdd-8c48-a8c9b003cf03 | 3 | @Override
public SampleableList sample() {
SampleableListImpl output = new SampleableListImpl();
if (size() == 0) {
return null;
}
for (int i = 0; i < size(); i = i + 2) {
if (array[i] != null) {
output.add(get(i).getReturnValue());
} else {
break;
}
}
return output;
} |
3a4a4a45-cce9-4ea5-a56a-2776386c9ec8 | 0 | public Map<MetaEnum, Object> getMeta() {
return this.getReferRequestWrapper().getMeta();
} |
aea1298b-e8e7-4748-8047-a72572f04041 | 0 | @Id
@Column(name = "PCA_SECUEN")
public Integer getPcaSecuen() {
return pcaSecuen;
} |
8538cb51-e00a-4fe0-8dad-1861ccec4978 | 8 | public static void main(String[] args) {
int i = 0;
outer: // Can�t have statements here
for(; true ;) { // infinite loop
inner: // Can�t have statements here
for(; i < 10; i++) {
System.out.println("i = " + i);
if(i == 2) {
System.out.println("continue");
continue;
}
if(i == 3) {
... |
e8741b97-1bed-4330-a3cd-891ddd62df1e | 6 | public ComputerControlPanel(final Computer computer) {
super(new FlowLayout(FlowLayout.CENTER));
// Construct components
final ExecutionSpeedSlider speedSlider = new ExecutionSpeedSlider();
final JButton step = new JButton("Step once");
JButton reset = new JButton("Reset... |
390f6829-d5af-47ca-92ed-e03d909f7701 | 8 | public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
Graphics2D g3 = (Graphics2D)g;
Graphics2D cookingArea = (Graphics2D)g;
Graphics2D platingArea = (Graphics2D)g;
//Clear the screen by painting a rectangle the size of the frame
g2.setColor(getBackgroun... |
01cf3006-f7be-4e4f-8979-9d1760b26425 | 0 | @Override
public void operation() {
getImplementor().operation();
} |
0b181ec4-bdb1-4f07-9a1a-eb0cb1b62c5a | 3 | public double[] apply(double[] spectrumData) {
if (spectrumData == null) {
return null;
}
int specLen = spectrumData.length;
int barkLen = getNumberOfBarkBands();
// initialize output vector
double[] barkSpec = new double[barkLen];
// f ... fre... |
ee88e9c5-b99d-44fb-a2d9-14b507ff894d | 3 | @Override
public boolean isDone(Game game) {
boolean ended = super.isFinished(game);
if(ended)
return true;
if(game.getNumSprites(itype) - game.getNumDisabledSprites(itype) <= limit && canEnd) {
countScore(game);
return true;
}
return fa... |
92bb34bc-eede-487a-b7f4-1257dfa475f5 | 1 | public static final JsonElement toJson(Object object){
if(object instanceof String){
return parse((String)object);
}
return GSON.toJsonTree(object);
} |
7c827d51-9720-4b08-9f96-0035cd755181 | 9 | protected void propagateClassifier()
{
switch (mappingChoice.getSelectedIndex())
{
case RAYTRACE: // raytrace rendering.
case VIEWSPACE: // viewspace.
classificationChoice.setEnabled(true);
if (classificationChoice.getSelectedIndex() == VJClassifiers.ISOSURFACE)
classificationChoice.select(VJCla... |
fcdabcd1-2ba6-4f96-8ce1-c79edb3b6461 | 1 | void parseDocument() throws java.lang.Exception
{
char c;
parseProlog();
require('<');
parseElement();
try {
parseMisc(); //skip all white, PIs, and comments
c = readCh(); //if this doesn't throw an exception...
error("unexpected character... |
523ea3e0-9f50-4e2f-8e06-841d9b3c9ba7 | 5 | public void makeGlobalObject(int x, int y, int typeID, int orientation, int tileObjectType){ //Makes Global objects
for (Player p : server.playerHandler.players){
if(p != null){
client person = (client)p;
if((person.playerName != null || person.playerName != "null")){
if(person.distanceToPoint(x, y) <= ... |
d304ae59-598e-48e1-a0ed-c52b4906324e | 9 | private void handleSubCommandPlayers(String[] args, Player executingPlayer) {
if (args.length == 1) {
GrubsMessager.sendMessage(executingPlayer, GrubsMessager.MessageLevel.ERROR, "Not enough arguments.");
}
if (GrubsLaserTag.getGameState() == GrubsLaserTag.GAME_STATES.ACCEPT_PLAYERS ||
GrubsLaserTag.getGa... |
5fd1ada2-b134-4d57-8f10-6f43d7d30631 | 8 | private void checkActivationName(String name, int token)
{
if (parser.insideFunction()) {
boolean activation = false;
if ("arguments".equals(name)
|| (parser.compilerEnv.activationNames != null
&& parser.compilerEnv.activationNames.containsKey(name... |
73f5d8dd-a6e4-46a1-b578-70f95e297530 | 8 | public void move(ArrayList<Cell> moveableCells, Board board, Ball ball) {
ArrayList<Cell> targetList = new ArrayList<Cell>(moveableCells);
if(!hasBall) {
//eDistanceBetween returns the straight line distance between 2 points. If the player is next to the ball, he attempts to steal
//if he is not next to th... |
8e5020be-1b22-4c67-9f21-ca7b21bc737d | 6 | static protected void UpdateLineColumn(char c)
{
column++;
if (prevCharIsLF)
{
prevCharIsLF = false;
line += (column = 1);
}
else if (prevCharIsCR)
{
prevCharIsCR = false;
if (c == '\n')
{
prevCharIsLF = true;
}
else
line += (column = ... |
2448f60c-0820-4ced-9409-c2b462300b93 | 4 | @EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
final Player player = event.getPlayer();
if (plugin.getConfig().getBoolean("Optional.Login_Activation")) {
plugin.getServer().getScheduler()
.runTaskAsynchronously(plugin, new Runnable() {
public void run() {
if (plugin.checkAcco... |
94d86d87-a6a8-465a-b8a6-f3d21219dd44 | 1 | public MemoryMapper(String outputdir,String filename){
int i;
//memc=new byte[65536];
memnc=new int[65536];
for(i=0;i<65536;i++){
// memc[i]=0;
memnc[i]=0;
}
dumpFile=new File(outputdir,filename+".mmap");
} |
f0df25ac-b866-41c1-b6c9-8ebb6647b808 | 6 | public boolean checkRessourceAvailability(int resType, String startDate, String endDate, int requestedQty) {
//CONNECTION SKAL IKKE MED I PARAM, HENT FRA GETINSTANCE. SLET KALD HELE VEJEN GENNEM STRUKTUREN
int bookedQty = 0;
int totalStorageQty = 0;
//startDate = "2014-01-13";
//... |
a6984a23-51c8-4ba6-9c9a-0a1f91ed1a0f | 4 | public static void main(String[] args)
{
for( int i=0; i<POPULATION_SIZE; i++ )
population[i] = new Individual();
// for( int i=0; i<POPULATION_SIZE; i++ )
// System.out.println( "POPULATION[" + i + "]: " + population[i] );
for( int i=0; i<POPULATION_SIZE; i++ )
sumFitness += population[i].fitness;
... |
531bc27e-08fa-49f2-9b9c-4d00452e9369 | 1 | @Override
public List<Funcao> Buscar(Funcao obj) {
String Consulta = "select l from Funcao l";
if(obj != null){
Consulta = Consulta + " where l.nome like '%" + obj.getNome() + "%'";
}
Query q = manager.createQuery(Consulta);
return q.getResultList();
} |
a6d73c75-430f-4a70-acb5-3e0a9a27043f | 1 | public void move() {
if (nextGlied != null) {
nextGlied.move();
}
this.x += getDirection().getX() * width;
this.y += getDirection().getY() * height;
} |
eb05484b-d2c2-46f3-9085-d9ca792f4809 | 8 | private JSONArray buildJson() {
JSONArray json = new JSONArray();
if (!initialized || entityIds.isEmpty()) {
return json;
}
int i = 0, size = entityIds.size();
for (String entityID : entityIds) {
try {
JSONObject entityObj = new JSONObject(... |
390ae539-f469-4cc7-86b8-12b271096394 | 1 | public static ItemFactory create(){
if(itemFactory == null){
itemFactory = new ItemFactory();
}
return itemFactory;
} |
313b64dd-d66d-4f97-add2-d4c6f59a231c | 0 | @Override
public void execute() {
p.setBackground(Color.orange);
} |
d89ec535-90d7-46bd-9eac-be2049033b06 | 3 | private double getGeneOverlap(LabelGene gene, GeometryFactory factory) {
Geometry geometry = gene.getGeometry();
LinkedList<Geometry> overlappingObjects = new LinkedList<Geometry>();
overlappingObjects.add(avoids.intersection(geometry));
for (LabelGene otherGene : this) {
if (otherGene != gene) {
if (gen... |
2c7c5521-0c35-483e-91ec-457ed82ec5b4 | 5 | public static float[][] getClusterDistance(int kc, float[][][] X, int min) {
float tempX[][] = new float[kc][2];
float tempY[][] = new float[kc][2];
for (int i = 0; i < X.length; i++) {
for (int j = 0; j < X.length; j++) {
if ((int) X[i][0][0] >= min) {
if (X[i][0][0] == X[j][0][0]) {
tempX[(int... |
e0d72b8a-fcea-49be-bb82-e324890d4540 | 2 | public void setState(int state) {
if (this.state != state) {
this.state = state;
stateTime = 0;
if (state == STATE_DYING) {
setVelocityX(0);
setVelocityY(0);
}
}
} |
c275cf2d-65b3-4fee-a01b-071a5604e430 | 9 | private static void splitWordsAndDefs(String[] str)
{
ArrayList<String> wordList = new ArrayList<String>();
ArrayList<String> defList = new ArrayList<String>();
for(String s : str)
{
String word = "";
String def = "";
char[] ch = s.toCharArray();
int section = 0;
for(int i = 0; i < ch.le... |
a278ce40-04af-4be7-9131-f57ee92bdd20 | 2 | @Override
public int sizeOf( Class<?> v )
{
return (v == null ? Compress.NULL_SIZE : Compress.sizeOfUnsignedNullable( v.getCanonicalName().length() ) + v.getCanonicalName().length() );
} |
d5464ad8-2b1b-4dac-9dbb-4143e5820759 | 6 | public void run(){
final double GAME_HERTZ = 40.0;
//final double TARGET_FPS = 60.0;
final double TIME_BETWEEN_UPDATES = 1000 / GAME_HERTZ;
final int MAX_FRAMESKIP = 5;
long lastTime = System.currentTimeMillis();
long currentTime = 0;
long step = (long) TIME_BETW... |
91675060-3381-4ee1-ab80-f2b02e25cfc1 | 4 | @Override
public String buscarDocumentoPorEmpresa(String empresa) {
ArrayList<Venta> geResult= new ArrayList<Venta>();
ArrayList<Venta> dbVentas = tablaVentas();
String result="";
try{
for (int i = 0; i < dbVentas.size() ; i++){
if(dbVentas.get(i).getEmpr... |
3a4a8aea-6784-4709-8f86-3d96830c4452 | 8 | @Override
public void mousePressed(MouseEvent e)
{
cellWidth = view.getWidth() / view.getBoardSize();
cellHeight = view.getHeight() / view.getBoardSize();
pressedX = e.getX() / cellWidth;
pressedY = e.getY() / cellHeight;
if(pressedY == 0)
{
pressedY = 7;
}
else if(pressedY == 1)
{
pres... |
07dafe90-e9d3-4c19-b4f4-e3d91f9187c7 | 6 | public MultiTermEnum(IndexReader topReader, IndexReader[] readers, int[] starts, Term t)
throws IOException {
this.topReader = topReader;
queue = new SegmentMergeQueue(readers.length);
matchingSegments = new SegmentMergeInfo[readers.length+1];
for (int i = 0; i < readers.length; i++) {
... |
ec842e00-ca0c-4cc8-a708-1c11f157d4b6 | 8 | private double leastSquaresNonMissing(Instances instances, int attIndex) {
double numerator=0, denominator=0, w, t;
double[] classMeans = new double[m_numOfClasses];
double[] classTotals = new double[m_numOfClasses];
for (int i=0; i<instances.numInstances(); i++) {
LADInstance inst = (LADInstanc... |
a8de045c-7002-4230-9c7d-f56c5a0610b9 | 2 | public void render(){
for(int y = 0; y < height; y++){
for(int x = 0; x < width; x++){
Tile.getTileById(data.get((y * width) + x)).render(x * tileSize, y * tileSize);
}
}
} |
70143dab-7da5-47b1-86a5-d0549dd98401 | 3 | @Override
public Class getColumnClass(int column) {
Class returnValue;
if ((column >= 0) && (column < getColumnCount())) {
if(getValueAt(0, column)==null)
return String.class;
returnValue = getValueAt(0, column).getClass();
... |
323b2f76-9535-40a6-9645-93773a7af8a9 | 5 | public static boolean hasMethod(final Class<?> clazz, final String name) {
boolean found = Boolean.FALSE;
if ((clazz != null) && (!StringUtils.isEmpty(name))) {
int i = 0;
final Method[] methods = clazz.getDeclaredMethods();
while ((i < methods.length) && (!found)) {
found = methods[i].getName().equals... |
9bf78602-b28f-46f4-ae7a-151b6486f64f | 6 | public static void evaluateResult(TestVector v, Object result) {
if (v.pass) {
if (result instanceof String && v.expected.equals((String)result))
System.out.print("*PASS*: ");
else
System.out.print("*FAIL*: " );
System.out.println("input: [" + v.input + "] output: [" + v.expected
+ "] result: [... |
ed3b92ae-e9b5-4f8c-8688-c83d89419cb8 | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
0825782e-89a2-4902-b323-1efc01e61967 | 6 | public static int getAbsoluteValue(int i, NumberSign sign) {
if(i == 0 || i == -0) {
return 0;
}
if(sign.equals(NumberSign.NEGATIVE)){
int r = (i < 0 ? i : -i);
return r;
} else if (sign.equals(NumberSign.POSITIVE)) {
int r = (i < 0 ? -i : i);
return r;
} else {
return 0;
}
} |
de2e477c-e083-438b-8ef7-8a17099e5b9f | 1 | @Test
public void testGetAvailableMoves() {
System.out.println("getAvailableMoves");
Board board = new Board(8, 12);
RuleManager instance = new RuleManager();
Set<Position> expResult = new HashSet<>(4);
expResult.add(new Position(5, 2));
expResult.add(new Position(5,... |
6cb50812-9f32-4d26-9d68-c8a5f9a78d10 | 9 | public void calcBestPastrLocation() throws GameActionException {
if (bestPastrLoc == null) {
int MIDX = (rc.getMapWidth() / 2);
int MIDY = (rc.getMapHeight() / 2);
int[] info;
switch (this.HQ_LOCATION) {
case TOP:
comms.sendSearchCoord... |
d2ea3c35-e882-484b-8d78-b49f089f4da6 | 0 | public ImportFileMenuItem(FileProtocol protocol) {
setProtocol(protocol);
addActionListener(this);
} |
f1727ef1-028e-489b-9269-6edb83cadea7 | 8 | public boolean write( )
{
boolean result = false;
try { //Try to load the mysql Driver
Class.forName("com.mysql.jdbc.Driver");
try { //Try to open a connection to the mysql server
String url = settingsMap.get("URL");
String user = settingsMap.get("username");
String passwd = settingsMap.get("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.