method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4e01d9d9-0739-47c1-a2d2-4656f2687a30 | 8 | private void checkKeys() {
if (Keyboard.typed(KeyEvent.VK_LEFT)) {
moveTiles(Direction.LEFT);
if (!hasStarted)
hasStarted = true;
}
if (Keyboard.typed(KeyEvent.VK_RIGHT)) {
moveTiles(Direction.RIGHT);
if (!hasStarted)
hasStarted = true;
}
if (Keyboard.typed(KeyEvent.VK_UP)) {
moveTiles(... |
6ed6a06d-6174-492c-b23c-81a9bb1c9092 | 5 | public void writeControl (byte type, byte request,
short value, short index, byte buf [])
throws IOException
{
if (buf == null) {
// assume we're doing a No-Data-Control, and somebody
// has to make a 0-length buf
buf = new byte[0];
}
if (buf.length >= MAX_CONTROL_LENGTH
|| (type & Cont... |
6d778ef3-4659-4ee6-b1cb-b1d3d66d6fc3 | 5 | public void parse() throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader(getFichierObject()));
String line = null;
String[] lineSplit;
String[] vertex;
List<Vecteur> vts = new ArrayList<>();
List<Vecteur> vns = new ArrayList<>(... |
1b417617-1a2f-4b64-9be6-ce14b86cb1cb | 9 | protected void computeRect(Raster[] sources,
WritableRaster dest,
Rectangle destRect) {
int formatTag = MediaLibAccessor.findCompatibleTag(sources, dest);
MediaLibAccessor srcMA1 =
new MediaLibAccessor(sources[0], destRect, forma... |
17cb8b9b-f6ca-4607-9d7d-aecb663de23f | 0 | public boolean isLayer() {
return isLayer;
} |
8822952e-78fb-4896-89db-563128376fe2 | 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 DeliveryPacket)) {
return false;
}
DeliveryPacket other = (DeliveryPacket) object;
if ((this.id == null && othe... |
32f74984-76c7-4630-85f1-4cb57d9faf01 | 3 | public int getMax(int[][] matrix, int startRow) {
int curMax = 0;
for (int i = startRow; i < matrix.length - 1; i++) {
for (int j = i + 1; j < matrix.length; j++) {
if (matrix[i][j] > curMax) {
curMax = matrix[i][j];
}
}
}
return curMax;
} |
32132eae-c604-47a3-be1b-ff122ddea88d | 1 | public static void rebuildSessionFactory() {
try {
configuration.configure(configFile);
sessionFactory = configuration.buildSessionFactory();
} catch (Exception e) {
System.err
.println("%%%% Error Creating SessionFactory %%%%");
e.printStackTrace();
}
} |
0697afb3-f807-499a-a96d-758fcf26441d | 5 | private void pop(char c) throws JSONException {
if (this.top <= 0) {
throw new JSONException("Nesting error.");
}
char m = this.stack[this.top - 1] == null ? 'a' : 'k';
if (m != c) {
throw new JSONException("Nesting error.");
}
this.top -= 1;
... |
01109dbb-ba78-473a-b039-a5b11c39a825 | 3 | private int getMaxChildHeuristic(Map <Integer, Integer> heuristicMap) {
int maxWeight = 0;
for (TrieNode child : this.children.values()) {
Integer weight = heuristicMap.get(Integer.valueOf(child.getId()));
if (weight != null && weight > maxWeight) {
maxWeight = weight;
}
}
return ma... |
ee1827ff-aabf-4b06-ab72-bcea58184c1c | 7 | public DirectionalDeltaSource getDirectionalDelta()
{
if (empty)
throw new IllegalStateException("No element(s) have been added to cumulative delta");
return new DirectionalDeltaSource()
{
private DirectionalFragment fragment = forward;
private int number = 0;
private int dataAt = 0;
public boole... |
b07b7328-ced8-4cbe-9877-e5631911137b | 3 | @Override
public Iterator<T> iterator() {
return new Iterator<T>(){ // Classe anonyme LLIterator
private SLLNode<T> nextNode = head;
private int nbLeft = size;
@Override
public boolean hasNext() {
return nbLeft > 0;
}
... |
be8215a7-22ba-4ece-9fa1-634d2e7fd000 | 2 | public String getPrettyWarnings() {
String warnings = null;
if (hasWarnings()) {
for (String warnMsg : getWarnings()) {
warnings = warnings + "|" + warnMsg;
}
} else {
warnings = "Unknown";
}
return warnings;
} |
450982b6-3671-42d0-ab43-c6774f197b33 | 7 | private void demo() {
String protocol = "http://";
String port = ":5910";
String hostname="";
try {
hostname = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(hostname.equals("127.0.0.1"))
ho... |
be0f653b-e8b9-4500-9e83-22250eea3111 | 3 | @Override
public void run() {
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
double x = 0., y = 0.;
ThreadLocalRandom rand = ThreadLocalRandom.current();
... |
ef470524-2917-4fe8-9ab7-fadb82a967e6 | 3 | @Test
public void lineOneTomorrowAdenExpl() {
LinkedList<String> meals = new LinkedList<String>();
LinkedList<String> price = new LinkedList<String>();
Canteen curCanteen = new Canteen(new CanteenData(CanteenNames.ADENAUERRING, 1));// 1 for "tomorrow"
for (MealData m : curCanteen.getCanteenData().getLines().ge... |
3b493429-f110-4df3-a765-4e2081c0ff98 | 7 | public static void playSound(String pathToFX) {
try {
soundFile = new File(pathToFX);
} catch (Exception e) {
e.printStackTrace();
}
try {
audioStream = AudioSystem.getAudioInputStream(soundFile);
} catch (Exception e) {
e.printStackTrace();
}
audioFormat = audioStream.getFormat();
DataLi... |
ab7968ed-bc2e-4cfb-ab19-46315d4b79a8 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
5ae1b772-af93-47e7-a97d-702fdaeee353 | 4 | public static double cbrt(double x) {
/* Convert input double to bits */
long inbits = Double.doubleToLongBits(x);
int exponent = (int) ((inbits >> 52) & 0x7ff) - 1023;
boolean subnormal = false;
if (exponent == -1023) {
if (x == 0) {
return x;
}
... |
23782220-69b2-46f9-ad1d-463e2cb23701 | 1 | public void makeDeclaration(Set done) {
block.propagateUsage();
block.makeDeclaration(done);
if (nextByAddr != null)
nextByAddr.makeDeclaration(done);
} |
b5bf32cb-08dc-4c98-adc1-c71c8a9a5c94 | 9 | public static List<Long> triggerAfterSubmissionEvaluation(Submission submission) {
Problem problem = submission.getProblem();
if (problem==null){
throw new IllegalArgumentException("Problem cannot be null");
}
if (problem.getId()==0){
throw new IllegalArgumentException... |
a4792bbb-238e-4414-8a01-8763cd39b93d | 3 | @Override
public void sort(int[] array) {
for( int i = 0, s = array.length; i < s; ++i ) {
Integer min = array[i];
int minIndex = i;
for( int j = i+1; j < s; ++j ) {
if( min > array[j] ) {
minIndex = j;
min = array[j];
}
}
int swap = min;
array[ minIndex ] = array[i];
array... |
33c95150-c639-4721-8c27-9a02fb9ba464 | 1 | public static void main(String[] args) {
for (String arg : args) {
params += arg + "\n";
}
} |
2f6ca0f9-65c4-4155-8389-615d03044f30 | 5 | @Override
public void mousePressed(final MouseEvent e) {
final Point p = e.getPoint();
final Element element = getGraphicPanel().getElementAt(p);
if (element instanceof Vertex) {
final Vertex vertex = (Vertex) element;
if (this.edge == null) {
this.edg... |
abf9c242-eab4-41eb-a0cb-9739af5053c3 | 8 | public void mouseClicked(MouseEvent mouse){
System.out.println(mouse.getSource());
if(conversationJLabels!=null){
for(JLabel jl:conversationJLabels){
if(mouse.getSource().equals(jl)){
System.out.println("Clicked JLabel");
for(DialoguePart dp:conversationDialogue){
if(jl.getText().equals(dp.ge... |
13a5c61c-e2a6-4f07-adec-d5ecab91cf02 | 5 | public EmployeeGUI() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JPanel panel = new JPanel();
panel.setBounds(0, 0, 448, 271);... |
f7a0ff57-8c53-4ed1-9d61-f2fd7634ae3f | 5 | @Override
public void init(){
global.setSystemLaF(true);
if(getParameter("url")!=null)
if(!(getParameter("url").equals("none"))){
//loaders.WebFile file=null;
String in="";
try {
URL url = new URL(getParameter("url"));
Buffe... |
57c50748-07a6-4933-a71f-eb2ed941ce56 | 5 | public void advance() {
try {
switch (parser.ttype) {
case StreamTokenizer.TT_NUMBER:
tokenType = TYPE_INT_CONST;
intValue = (int)parser.nval;
break;
case StreamTokenizer.TT_WORD:
String w... |
1647578c-9969-4dd3-98f4-694236e2fa93 | 7 | public static int searchInsert(int[] A, int target) {
if (null == A || 0 == A.length) return 0;
int low = 0;
int high = A.length - 1;
while (low < high) {
int mid = (low + high)/2;
if (A[mid] == target) return mid;
else if (A[mid] < target) low = mid + 1;
... |
a95c6cca-22ee-4acb-8c98-60676ac942a1 | 2 | public static void main(String[] args) {
System.out.println("Opening port...");
try {
serverSocket = new ServerSocket(PORT);
} catch (IOException iex) {
System.out.println("Unable to attach to port!");
System.exit(1);
}
do {
handeClient();
} while (true);
} |
3217ac42-a42b-4841-9492-23c3216f48ae | 1 | public void setSubExpressions(int i, Expression expr) {
int diff = expr.getFreeOperandCount()
- subExpressions[i].getFreeOperandCount();
subExpressions[i] = expr;
expr.parent = this;
for (Operator ce = this; ce != null; ce = (Operator) ce.parent)
ce.operandcount += diff;
updateType();
} |
28962908-d0d7-4dce-a298-7a24e637adb9 | 6 | public void mouseReleased(MouseEvent e) {
if (layerDrag && (e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
Dimension d = getSize();
CPArtwork artwork = controller.getArtwork();
Object[] layers = artwork.getLayers();
layerDrag = true;
layerDragY = e.getPoint().y;
int layerOver = (d.heigh... |
5425de17-d7d3-4974-bbd4-47daff8c4a75 | 9 | public final void handleDestroy(BlockBreakEvent event)
{
destroy(event);
if (event.isCancelled())
return;
event.setCancelled(true);
Block block = event.getBlock();
block.setType(Material.AIR);
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
for (Iterator<ItemStack> dropped = getDrops().it... |
d809221a-779f-45a1-ab5f-bbf15144f091 | 8 | public ObjectInfoObjectType(SyntaxPart n1,
UnitsPart n2,
AccessPart n3,
StatusPart n4,
DescriptionPart n5,
... |
5bfbfe99-27af-4f72-856d-942c8cb30aa9 | 9 | private void pollInput() {
while (Keyboard.next()) {
if (Keyboard.getEventKeyState()) {
if (!toast.visible) {
if (Keyboard.getEventKey() == Keyboard.KEY_A) {
Main.getGamestate().getPlayer().move(-1, 0);
} else if (Keyboard.getEventKey() == Keyboard.KEY_D) {
Main.getGamestate().getPlayer()... |
c911304d-bf2b-41dc-b327-598d8952c09c | 1 | public byte[] findAttribute(String name) {
if (unknownAttributes != null)
return (byte[]) unknownAttributes.get(name);
return null;
} |
7495540c-335b-4715-ae85-75393e4f3b65 | 7 | public void reset() {
for (int z = 0; z < mapSizeZ; z++) {
for (int x = 0; x < mapSizeX; x++) {
for (int y = 0; y < mapSizeY; y++) {
groundTiles[z][x][y] = null;
}
}
}
for (int i = 0; i < SceneGraph.anInt472; i++) {
for (int j = 0; j < SceneGraph.cullingClusterPointer[i]; j++) {
SceneGra... |
55f6f87e-d0ad-4b64-bd3a-1e9cddcc2893 | 4 | public void toggle(){
if (bombsBeingRevealed || isOpen)
return;
if (markIndex == 0)
MainFrame.changeFlagCount(true);
else if (markIndex == 1)
MainFrame.changeFlagCount(false);
++markIndex;
markIndex %= 3;
/*
if (markIndex != 0)
getModel().setEnabled(false);
else{
getModel().setEnabled(tru... |
8380e44a-5eb7-4bda-a478-20117b81d487 | 4 | public List<AssignmentObj> getAssignmentTable(PreparedStatement pre, boolean inner) {
List<AssignmentObj> items = new LinkedList<AssignmentObj>();
try {
ResultSet rs = pre.executeQuery();
if (rs != null) {
while (rs.next()) {
AssignmentObj item... |
e491f042-ccd3-48ff-b48e-b61788d55fa6 | 2 | private void isEqualToInteger(final Object param, final Object value) {
if (value instanceof Integer) {
if (!((Integer) value).equals(((Integer) param))) {
throw new IllegalStateException("Integers are not equal.");
}
} else {
throw new IllegalArgumentException();
}
} |
d45fa34a-41fb-4cc8-972b-d8a80e9ecc59 | 8 | public Node getNodeAt(Graphics2D g2, Point point) {
Rectangle rect = new Rectangle(point.x - 1, point.y - 1, 3, 3);
for (Node node : tree.getExternalNodes()) {
Shape taxonLabelBound = tipLabelBounds.get(node);
if (taxonLabelBound != null && g2.hit(rect, taxonLabelBound, false)) {
return node;
}
}
... |
7f720f05-d571-48b3-ba00-34646cd790c7 | 1 | Item newDouble(final double value) {
key.set(value);
Item result = get(key);
if (result == null) {
pool.putByte(DOUBLE).putLong(key.longVal);
result = new Item(index, key);
put(result);
index += 2;
}
return result;
} |
9574850f-6538-4913-b8ab-ece14f1265f9 | 0 | public void setHora(int hora) {
this.hora = hora;
} |
20a9439a-172f-406d-82ad-f8c91bcce425 | 3 | public void addNewOccurrence(String document) {
//Duplicate checking
boolean add = true;
for(Occurrence occ: docsList.toArray()){
if(occ.getDocName().compareTo(document) == 0){
add = false;
occ.incFrequency();
}
}
if(add){
... |
d9b11d77-940e-44bf-bcaa-bb95e61c6423 | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
final Physical affected = this.affected;
if((affected instanceof MOB)&&(this.beingSpoken(ID())))
{
final MOB mob=(MOB)affected;
final Room R=mob.location();
if((R!=null)
&&(R.getArea() instanceof BoardableShip)
||((mob.riding()!=null)&... |
040585ea-fc6d-4ffd-b78f-ef46293bd1b3 | 3 | @Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
logger.info("User Login to initialize authorized.....");
ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal();
//1)获取用户信息的所有资料,如权限角色等.
User user = userService.findUser(shiroUser.... |
f1cd7dfe-9756-4ca4-b5a4-91712b50e3c4 | 9 | public void buyPotatoes(String hisName)
{
Scanner scan = new Scanner(System.in);
for (int i = 0; i < theGame.listOfFarmers.length; i++)
{
if (hisName.equalsIgnoreCase(theGame.getFarmersName(i)))
{
System.out.println("You can buy " + theGame.getFarmersA... |
cc437149-e11b-4e6d-8d1e-31da1025c9e9 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final ScyReturPabrikItemPK other = (ScyReturPabrikItemPK) obj;
if (!Objects.equals(this.noDokumen, other.noDoku... |
794d12fa-e793-412b-9d14-3d6b2286bed9 | 0 | @Override
public String toString() {
return "rlog:" + name();
} |
e19d20ae-e3ce-426c-8b63-cd825d6a02f0 | 9 | private static Player nightPhaseHelper(GameState state, Color faction)
{
for(Player p : state.getPlayerList())
{
if(p.getFaction().equals(faction))
{
while(state.getTime() == Time.NIGHT)
{
Player player = state.getPlayer(faction);
if(player != null)
{
ArrayList<Card> den = ... |
b3472cb7-57f8-4571-8404-e70b90ff0e7f | 4 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == krakButton) {
if(task.isDone()) {
view.setVisible(true);
}
else {
krakButton.setEnabled(false);
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURS... |
e9f9b429-b391-45b0-84f5-c9570d3275e7 | 5 | private void load(){
String path="";
defaults = new ArrayList<ArrayList<String>>();
try {
path = SBStringUtils.getAppPath("data");
File file = new File(path, fileName);
if (file.exists()){
CSVReader reader = new CSVReader(new FileReader(file));
try {
while (true){
String[] f... |
f0dbe0c0-dbdb-4f10-bcd5-58e773109e6c | 6 | static void lireChoix() {
int choix = 0;
while (choix < 5) {
choix = afficheMenu();
switch (choix) {
case 1: // deplacer(porteAvion pa, Avion avion);break;
case 2:// decoller(Avion avion);break;
case 3:// atterir(Avion avion); break;
case 4: // rienFaire(); break;
case 5:
quitter();
br... |
e298edfe-f231-4e76-8fe3-afc4aac4b776 | 6 | void printBandwidth(PassthroughConnection ptc, long time) {
int total = 0;
for(int cnt=0;cnt<256;cnt++) {
total += ptc.packetCounters[cnt] - ptc.packetLastCounters[cnt];
}
ptc.printLogMessage("");
ptc.printLogMessage("Bandwidth Stats - last " + (period/1000) + " seconds" );
for(int cnt=0;cnt<256;cnt++) ... |
5125eacb-3770-4596-acb2-816a9b2ccbb5 | 0 | public void setSampleOutput(String sampleOutput) {
this.sampleOutput = sampleOutput;
} |
d5a4a871-1343-4010-be6c-b3c0a4752162 | 8 | public void ge_while_jump(TextArea area,String prefix,int cur_while_num){
if(or_last<=0 && and_last<=0){
String instr =prefix+ "br i1 %cmp"+String.valueOf(cmp_num-1)+", label %land.lhs.true"+String.valueOf(true_num)+", label %lor.lhs.false"+String.valueOf(false_num)+"\n\n";
area.append(i... |
fe6eba68-c1a2-47d1-81bd-ac3ad04d4577 | 5 | private void calculateExtremPoints() {
ModelProxy tmp;
String[] lowest = new String[]{"bottom", "left", "far"};
String[] highest = new String[]{"top", "right", "near"};
for (Map.Entry i : models.entrySet()) {
tmp = (ModelProxy) i.getValue();
for (String k : high... |
69f2d136-0334-44bc-9c7a-4c885fa8d8f4 | 5 | public static void arquivoPerceptron(String nome, Perceptron perceptron,
Double[][] amostras, Double[] esperado, Double[][] testes,
Double taxa, Integer maxEpocas) {
try {
FileWriter fileWriter = new FileWriter(nome);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
// for (int i = 0; i ... |
898d3513-b1ad-4564-a4d2-7ba17ad0813e | 7 | public void doGet(HttpServletRequest sreq, HttpServletResponse sres)
throws ServletException, IOException
{
String path = (String)
sreq.getAttribute("javax.servlet.include.servlet_path");
if (path==null)
path=sreq.getServletPath();
if (path.length()==0)
... |
040f2090-3075-4a53-887d-39a0cdcd2f85 | 2 | public void setMinus(GoTerm goTerm) {
if( symbolIdSet != null ) symbolIdSet.removeAll(goTerm.symbolIdSet);
if( interestingSymbolIdSet != null ) interestingSymbolIdSet.removeAll(goTerm.interestingSymbolIdSet);
} |
38c11ea6-b454-4b30-b87f-be6f845ae4e0 | 2 | public boolean existComplaint(int id) {
for (int i=0; i < complaints.size(); i++) {
if (complaints.get(i).getId() == id) return true;
}
return false;
} |
6fbf928d-5f17-4f17-8284-eee6874b677e | 5 | public void doGame() throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("what will your fingerprint be?");
String in = br.readLine();
this.client.network.setFingerprint(in);
System.out.println("commands are 'connect' and 'disconnect'");
whi... |
e198d263-b32c-46d2-b3f3-764317845b1d | 5 | public boolean isDefault(aos.apib.Base o) {
HeartBeatTimer v = (HeartBeatTimer)o;
if (v.peerID != __def.peerID) return false;
if (v.upload != __def.upload) return false;
if (v.download != __def.download) return false;
if (baseclasses != null && baseclasses.length == 1)
return baseclasses[0].isDe... |
e04ed158-e051-49e5-b5f1-2bb5847e934c | 4 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._tipo_ == oldChild)
{
setTipo((PTipo) newChild);
return;
}
for(ListIterator<PVar> i = this._var_.listItera... |
76840dd0-7286-4133-b9b1-3cc3961b1ba1 | 0 | public LSystemInputPane getInputPane() {
return (LSystemInputPane) getSource();
} |
892d040a-d773-485d-beed-b6ffc646434b | 2 | @Override
public Vehicule putVehicule(Vehicule v) throws BadResponseException, JSONException {
Representation r = new JsonRepresentation(v.toJSON());
r = serv.putResource("intervention/" + interId + "/vehicule", null, r);
Vehicule vehicule = null;
try {
vehicule = new Vehicule(new JsonRepresentation(r).ge... |
cbd05224-4235-48d1-baec-5882729a6680 | 0 | public boolean getGodMode(){
return godMode;
} |
c466ca5f-ccbd-48ca-8066-99d00bef1463 | 0 | public void setPanel(Panel p) {
this.panel = p;
} |
ef500793-58e8-4fac-932c-fa8342b99106 | 4 | public void setSenao(List<?> list)
{
for(PComando e : this._senao_)
{
e.parent(null);
}
this._senao_.clear();
for(Object obj_e : list)
{
PComando e = (PComando) obj_e;
if(e.parent() != null)
{
e.parent()... |
ea7ed4ea-2868-4e85-a58f-5939b2554b2a | 9 | private void updateOffsets() {
if (this.blockAnchor.equals(RectangleAnchor.BOTTOM_LEFT)) {
xOffset = 0.0;
yOffset = 0.0;
}
else if (this.blockAnchor.equals(RectangleAnchor.BOTTOM)) {
xOffset = -this.blockWidth / 2.0;
yOffset = 0.0;
}
... |
7e11ee2d-93a4-4de2-a62b-103cb09c45db | 9 | private DetectorMatch mozillaCheck( String fileName )
{
DetectorMatch back = null ;
nsDetector det = new nsDetector() ;
// Set an observer...
// The Notify() will be called when a matching charset is found.
MyMozillaObserver observer = new MyMozillaObserver() ;
det.Init( observer ) ;
t... |
e7548ad8-ebbf-44c5-9b15-15bef0b9fa61 | 7 | public void setWaypoint(double x, double y)
{
targetX = x;
targetY = y;
double myTheta = state.get(7) % (Math.PI * 2); //my theta, between 0 and 6.28
if(myTheta < 0) myTheta+= Math.PI * 2.0;
double yDist = (state.get(1)+scrollY) - targetY; //y and x distance to the waypoint
... |
89b345e4-8d22-4b4f-b727-9ae52d3667b1 | 8 | public Vector<String[]> filterTypes( Vector<String[]> oldStreams) {
//contains filtered streams
Vector<String[]> newStreams = new Vector<String[]>(0,1);
if(oldStreams.capacity()>0) {
for(int i=0; i < oldStreams.capacity(); i++) {
//add mp3 streams
if(showMP3Streams.isSelected() && oldStreams.ge... |
99da8647-41a2-4a54-a518-88a1c25efbe0 | 0 | public String getName() {
return name;
} |
5552134b-5bbd-4428-bddb-2aa1ac8ec515 | 4 | public boolean hasPrayItemInHand(Player p) {
//material equals
if(!p.getItemInHand().getType().equals(ConfigHandler.prayItem) || !p.getItemInHand().hasItemMeta())
return false;
//another check -.-
if(!p.getItemInHand().getItemMeta().hasDisplayName())
return false;
//has correct name
if(p.getItemInHand... |
b3eae3b0-da6a-4bc1-a981-6cc6d80c5590 | 2 | private void CalcNormals(Vertex[] vertices, int[] indices)
{
for(int i = 0; i < indices.length; i += 3)
{
int i0 = indices[i];
int i1 = indices[i + 1];
int i2 = indices[i + 2];
Vector3f v1 = vertices[i1].GetPos().Sub(vertices[i0].GetPos());
Vector3f v2 = vertices[i2].GetPos().Sub(vertices[i0].Ge... |
a864626a-7a01-4a74-a75e-e873b95711ad | 0 | public Integer LookupValue(Variable x) {
Integer i = valueMap.get(x);
return i;
} |
0431fea5-f925-4422-8193-f4b23bdcef15 | 3 | public void testFactory_between_RInstant() {
// test using Days
DateTime start = new DateTime(2006, 6, 9, 12, 0, 0, 0, PARIS);
DateTime end1 = new DateTime(2006, 6, 12, 12, 0, 0, 0, PARIS);
DateTime end2 = new DateTime(2006, 6, 15, 18, 0, 0, 0, PARIS);
assertEquals(3, Si... |
f7d36a28-33ce-4fc7-95a3-bc0213049990 | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -tile.sprite.SIZE || xa >... |
46c80b04-ebdd-416f-b934-5e571ee7d904 | 5 | public void move() {
int pinkoLHS = area.x;
int pinkoRHS = area.x + area.width;
if (pinkoLHS <= PINKO_MOVE_AREA_LHS) {
currentDirection = RIGHT;
}
if (pinkoRHS >= PINKO_MOVE_AREA_RHS) {
currentDirection = LEFT;
}
... |
99b5dfcd-9caf-468e-84aa-e8cc86afc8c8 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Player other = (Player) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return fa... |
36101725-6ed9-49a1-82f6-b92173ec8ee9 | 8 | public void paint(Graphics g) {
super.paintComponent(g);
Graphics2D graphics_2d = (Graphics2D) g;
//draw the chess board
graphics_2d.setColor(new Color(0,0,0));
graphics_2d.drawRect(0,0,600,600);
graphics_2d.setColor(new Color(128,121,124));
for(int i = 0; i < 500; i += 150) {
for(int k = 75; k <= 525... |
2dc5afbc-6988-48c7-8d14-5181dbeb02a8 | 6 | protected boolean setEstatCasella( EstatCasella e, int fila, int columna ) throws IndexOutOfBoundsException
{
switch ( getEstatCasella( fila, columna ) )
{
case JUGADOR_A:
num_fitxes_a--;
break;
case JUGADOR_B:
num_fitxes_b--;
break;
case BUIDA:
break;
}
switch ( e )
{
case J... |
5cad60b3-9927-492a-ba77-f0a5a2d4801e | 4 | public void atBinExpr(BinExpr expr) throws CompileError {
int token = expr.getOperator();
int k = CodeGen.lookupBinOp(token);
if (k >= 0) {
/* arithmetic operators: +, -, *, /, %, |, ^, &, <<, >>, >>>
*/
if (token == '+') {
Expr e = atPlusExpr... |
641ae642-4c95-4fb2-a999-6598d4042116 | 8 | protected int countNeighbours(int col, int row) {
int total = 0;
total = getCell(col-1, row-1) ? total + 1 : total;
total = getCell( col , row-1) ? total + 1 : total;
total = getCell(col+1, row-1) ? total + 1 : total;
total = getCell(col-1, row ) ? total + 1 : total;
total = getCell(col+1, row ) ? total +... |
354b6cee-faea-4d1e-a173-96b2969d9107 | 4 | private void fillHotels(List<Hotel> hotels, AbstractDao dao) throws DaoException {
if (hotels != null) {
for (Hotel hotel : hotels) {
Criteria descCrit = new Criteria();
descCrit.addParam(DAO_ID_DESCRIPTION, hotel.getDescription().getIdDescription());
... |
01b82d23-3516-446a-a0b2-585b8bec34db | 7 | private FactoryPoint<?> getFactoryPointByName(final List<FactoryPoint<?>> factoryPoints, final String name) {
for (final FactoryPoint<?> factoryPoint : factoryPoints) {
final FactoryPointMethod<?> factoryPointMethod = (FactoryPointMethod<?>) factoryPoint;
if (factoryPointMethod.getMetho... |
e23849d9-6e45-4efd-82a0-0cd2ba67a8c6 | 2 | public void stop()
{
if (volume != Volume.MUTE)
{
if (clip.isRunning())
clip.stop();
}
} |
7e326743-c014-4ed3-b9d1-78de0c457afa | 4 | public void removePiece(Pawn pawn){
if (this.type.equals("start")){
this.numOccupants--;
if (this.numOccupants == 0)
this.occupied = false;
this.pawnList.remove(pawn);
}
else if (this.type.equals("home")){
this.numOccupants--;
if (this.numOccupant... |
1a7f0c5a-8266-49ce-91ce-19d5718869cb | 1 | public TDRodCutting(int n, int price[])
{
this.n = n;
r = new int[price.length];
p = price;
cuts = new String[price.length];
r[0] = 0;
p[0] = 0;
cuts[0] = "";
for (int i = 1; i < price.length; i++)
r[i] = Integer.MIN_VALUE;
r[n] = cutRod(n);
} |
05402987-8e24-4fcd-a64e-12fc07e0837f | 6 | public static boolean chooseOpen() {
JFileChooser cho = new JFileChooser(file);
cho.setFileSelectionMode(JFileChooser.FILES_ONLY);
FileFilter emu = new FileFilter(){{}
@Override
public boolean accept(File f) {
if (f.isDirectory())
return true;
String ext = getExtension(f);
if (ext != null) {
... |
8364471e-f0c3-45ca-b6b9-b8527da2a14e | 5 | public String loadAgendamento() throws ParseException {
Map parametros = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
String dataStr = parametros.get("dataHora").toString();
DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dat... |
f0129e6a-8c42-42cb-837d-d8a42e8eb745 | 9 | void start (){
timer.start();
for (int i = 0; i < form.field.length; i++){
for (int j = 0; j < form.field[i].length; j++){
form.field[i][j] = false;
}
}
for (int i = 0; i < form.field.length; i++){
for (int j = 0; j < form.field[i].length... |
82b8d95e-bcd0-4b94-ad72-821203d2c075 | 0 | public ClientHandeler(ServerConnectionHandler serverConnectionHandler,
IdDto oo) {
this.conn = serverConnectionHandler;
this.id = oo.id;
} |
11d23a2d-f774-4cfc-bb86-dece04eef8c5 | 6 | public static void DFS(int r, int used, int mask, double curD) {
if (used >= dist.length || curD > min) {
min = Math.min(curD, min);
return;
} else
for (int i = r; i < dist.length; i++)
if ((mask & (1 << i)) == 0) {
mask |= (1 << i);
for (int j = i + 1; j < dist.length; j++)
if ((mask &... |
4e9d21c5-36f4-4cf0-87a6-f435f9da351a | 8 | private void updateButtonState() {
if (Simulation.isPaused() && !Simulation.isStarted()) { //if paused and simulation stopped
pauseSim.setText("Pause Simulation");
startSim.setText("Start Simulation");
pauseSim.setEnabled(false);
} else if (Simulation.isPaused() && ... |
c6615885-1eee-4bc6-998e-e70abfb1b663 | 7 | public boolean addModule(Module module){
boolean attemptToSchedule=true;
boolean coupled = false;
int count = 0;
if (scheduledModules.size() != 0){
for (Module moduleTwo : scheduledModules) {
if (checkCoupledModules(module, moduleTwo) != 0) {
//ie cannot be scheduled today, as already scheduled one... |
7ac5bb8c-b9f4-42f5-9a2b-c4c9d636661d | 8 | public static int BruteForce (String str, int start, String pattern) {
if (str == null || str.length() == 0 || pattern == null || pattern.length() == 0) {
return -1;
}
int i = start, j =0;
int sizeS = str.length(), sizeP = pattern.length();
while (i < sizeS && j < sizeP) {
if (str.charAt(i) == patter... |
123e57af-d3e5-4b1a-ba80-36ab8047d593 | 7 | public List<Controls> getControls(boolean detachPrimaryCheckbox) {
List<Controls> controlsList = new ArrayList<Controls>();
if (controls == null) {
OptionsPanel optionsPanel = new OptionsPanel();
final JCheckBox showTextCHeckBox = new JCheckBox("Show " + getTitle());
... |
378d8639-020c-45a8-8b42-4624dd77b9f8 | 0 | @Before
public void setUp() {
h = new BinaryHeap();
v = new Vertex(0, 0);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.