method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
99f1a0d7-64e4-4118-b89f-bad0bd1c6d97 | 9 | private boolean checkStartBuffer() {
int a,count=0,o;
// Check for 21 true bits in the first 44 bits
for (a=0;a<44;a++) {
if (startBuffer[a]==true) count++;
}
if (count!=21) return false;
count=0;
// Check the 70 bit session keys are almost the same
for (a=0;a<70;a++) {
if (startBuffer[a+44]!=star... |
b913f547-e650-41f0-b356-5e64f3e92342 | 2 | private boolean hasRowWithNumber(int number) {
for (Row row : rows) {
if (row.getNumber() == number) {
return true;
}
}
return false;
} |
886d8465-658b-4e6c-8a71-8c1f9a1f19d5 | 4 | public void setPlayerTitle(Player p, String title, boolean save)
throws UnknownTitleException {
String confPath = "players." + p.getName();
if (title.equalsIgnoreCase("none")) {
p.setDisplayName(p.getName());
if (save) {
fastTitles.getConfig().set(confPath, null);
}
} else {
String titleFormat ... |
35acac96-a2b1-4640-9a22-ad84457b6403 | 9 | public float GetDensity(String location){
float density = 0f;
WAQuery query = engine.createQuery();
query.setInput(location+" population density");
try {
WAQueryResult queryResult = engine.performQuery(query);
if (queryResult.isError()) {
} else if (!queryResult.isSu... |
d0545c7f-99b5-49af-859b-21331d1b540e | 5 | @Override
public void update(int mouseX, int mouseY, boolean pressed)
{
super.update(mouseX, mouseY, pressed);
if(this.btnResume.wasClicked())
Game.instance.setCurrentGui(null);
if(this.btnNewGame.wasClicked())
{
Game.instance.world = new World();
Game.instance.setCurrentGui(null);
}
if(this.b... |
99cd08b1-f33d-408f-8693-73765aa2beec | 7 | public static void SS() throws IOException{
int timeblock = 5;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (timeblock > 0){
System.out.println("What would you like to do right now?");
if (timeblock >= 3)
{
System.out.println("1. Study");
System.out.printl... |
cc0eb5d5-37ff-4003-8b66-8ccac9f79edc | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Tile other = (Tile) obj;
if (this.x != other.x) {
return false;
}
if (this.y ... |
8b7a5a60-ec4e-4369-a25a-5b35fee110d7 | 9 | public static long getScaleFactorDecimal(final String scaleUnit) {
if(scaleUnit == null) throw new IllegalArgumentException("Ihre Präfix-Angabe ist ungültig. " + scaleUnit);
if(scaleUnit.length() == 0) return 1;
switch(scaleUnit.toLowerCase().charAt(0)) {
case 'h':
return 100;
case 'k':
return 1000;... |
363dff40-4ad5-4d83-b18f-62aa270b4b2b | 4 | public void move(int shipx, int shipy){
if(getxCoord() < shipx+30){
this.setImageIcon(finImage1R);
setxCoord(getxCoord() + speed);
}
if(getxCoord() > shipx+30){
this.setImageIcon(finImage1);
setxCoord(getxCoord() - speed);
}
if(get... |
f3c32c3b-edfd-4dbd-b0cd-f27957fcc413 | 2 | public void setBlockLocation(SelectMode selectMode, Location location)
{
switch (selectMode)
{
case FirstBlock:
{
RegionManager manager = RegionManager.getInstance();
manager.addRegion(player.getUniqueId(), new Region());
getNew... |
251be659-e0dc-4f7e-b689-836c1d9cd0a9 | 6 | public void findGames(ArrayList<Game> games)
{
String name;
String path = ".";
String fileName;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
for(int i = 0; i < listOfFiles.length; i++)
{
if(listOfFiles[i].isFile())
... |
708a3b36-43b3-4149-8cde-830d7ef80bf7 | 3 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double a, b, c;
double i;
String str;
System.out.println("This program will sort from lowest to highest 3 numbers.");
System.out.print("Please enter your first number: ");
... |
499ecc59-125e-4a9c-b4cd-b3fc7eff954c | 1 | public String getEncoding() {
if (internalIn2 == null) return null;
return internalIn2.getEncoding();
} |
245394f5-d8b5-45e9-944f-8619d3deaab1 | 7 | public int numDecodings(String s) {
if (s == null || s.length() == 0 || s.charAt(0) == '0') {
return 0;
}
int[] number = new int[s.length() + 1];
number[0] = 1;
number[1] = 1;
int tmp;
for (int i = 2; i <= s.length(); i++) {
// 检查当前字符是不是'0'
tmp = Integer.parseInt(s.substring(i - 1, i));
if (tm... |
407acf50-9c8f-400f-8c71-cc05254e922c | 2 | private static void startStatCollector(String host, int port, final Connector connector) {
connector.setStatsOn(true);
logger.fine("Starting stats collector: " + host + ":" + port);
GangliaStat statCollector = new GangliaStat(host, port, 30, 60);
statCollector.addMetric(new StatReporter("os_cs_keys_regist... |
c872cedb-c5f1-4716-97fd-33be0ab3d0e1 | 9 | private Object handleSubn(Object tos, String id, String ref) {
if (tos instanceof Header && ref != null && ((Header)tos).getSubmissionRef() == null) {
((Header)tos).setSubmissionRef(ref);
return new Object(); // placeholder
}
else if (tos instanceof Header && ref == null && ((Header)... |
4854e787-6543-417b-8950-273dddb77cce | 5 | private void addCadenaOperador(String string) {
if (INICIO) {
if (maxCaracteres()) {
if (!ordenSecuencia()) {
if (!string.isEmpty()) {
if (cadenaCalculo.isEmpty()) {
cadenaCalculo = string;
... |
289436e4-4650-44e7-9356-99f30256b1f6 | 2 | public HashMap<String,HashMap<String,String>> getFriendships(){
HashMap<String,HashMap<String,String>> friendships = new HashMap<String,HashMap<String,String>>();
HashMap<String,String> buddies = new HashMap<String,String>();
Statement st;
ResultSet rs;
String query;
query = "SELECT * FROM friends";
try{
... |
3ac1a4b0-d7bf-4646-9f48-5976e5d92502 | 9 | final int importBinary(XMLElement elem, int offs, ByteBuffer buf, String fieldName)
throws XMLImportException
{
if (elem == null || elem.isNullValue()) {
offs = buf.packI4(offs, -1);
} else if (elem.isStringValue()) {
String hexStr = elem.getStringValue();
... |
1b63c34a-7ad5-44f7-ad51-c4c245cdd01d | 0 | public Layer getParentLayer() {
return parentLayer;
} |
db2dcb75-e879-4231-90c1-c9cae7867a4d | 7 | private boolean isBlocked(float x, float y) {
boolean blocked = false;
float tweakedX = x + 4;
float tweakedY = y + 8 + mapY;
int rowCount = genX / blockSize;
int startY = (Math.round(mapY / blockSize))* rowCount + 1;
int endY = (Math.round((mapY + screenHei... |
9531f029-96fc-42df-9816-2c21e3edd1ee | 6 | public void finishTag() throws TagParserException
{
// System.out.print("NT"+this.mLD());
TagNode container = this.containerStack.peek();
TagNode tag = this.temporaryTag;
// Parse the Attributes if there are any.
if(this.literalBuffer.length() > 0)
{
// Though before we do so,check if th... |
8d719e63-1b90-45fc-b55a-38e2ca42e781 | 9 | public MoveResult endOfMoveChecker(MoveResult battleResult)
{
MoveResult result = battleResult;
boolean redCanMove = false;
boolean blueCanMove = false;
if (result.getStatus() == OK) //If someone has not already won
{
for (PieceLocationDescriptor piece: pieceHandler.getRedPieces())
{
if (canMov... |
7d23541a-ba43-423a-b6a5-37fea257cc09 | 8 | private String checkIfInBounds(Point p) {
int borderSize = 25;
// right side
if (p.x >= this.getWidth() - borderSize && p.x <= this.getWidth()) {
// is in right side
return "right";
} else if (p.x >= 0 && p.x <= borderSize) {
// is in left side
return "left";
} else if (p.y >= 0 && p.y <= 10) {
... |
1757f187-7db7-4212-9e99-43bfa9c494a2 | 6 | public char deleteItem() {//since previous is already in the Links, switching the code around allows for a Queue implementation fairly trivially
char temp;
if (stack) {//this is the stack implementation, which is the assignment
if (isEmpty()) throw new EmptyStackException();
temp ... |
ed46c665-b2ef-447e-a2cb-a72ae8d03f25 | 6 | public void mousePressed(MouseEvent e) {
// click, moved from mouseClicked due
// to problems with focus and stuff
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) {
Point p = e.getPoint();
CPArtwork artwork = controller.getArtwork();
int layerIndex = getLayerNb(p);
if (layerIndex >= 0 &... |
fe1c9017-5b56-4b6e-b1f2-dc09891d4f5f | 4 | public void stop(String sourcename) {
if (sourcename == null || sourcename.equals("")) {
errorMessage("Sourcename not specified in method 'stop'");
return;
}
if (midiSourcename(sourcename)) {
midiChannel.stop();
} else {
Source mySource = sourceMap.get(sourcename);
if (mySource != null)
mySou... |
efea0926-d1c7-43b0-8bb9-f92ffc357f21 | 3 | public void actionPerformed(ActionEvent ae)
{
if(ae.getSource() == bp.getExit())
{
System.exit(0);
}
if(ae.getSource() == bp.getFight())
{
}
if(ae.getSource() == bp.getEndTurn())
{
engine.endTurn();
System.out.println("Turn Ending ...");
ep.addText("\nCash on hand: " + engine.getTaxes());
... |
dbc6357e-b507-44b9-aeea-6d9a7efb79ce | 6 | public static int getHeightItr(Node root){
//Write your code here
if(root == null) {
return 0;
}
int height = 0;
Queue<Node> children = new LinkedList<Node>();
children.add(root);
while(true) {
int childCount ... |
cdea2a55-3384-4526-ba1c-7324058d0871 | 3 | public static ArrayList<Rating> getTestSet(String file) {
ArrayList<Rating> testset = new ArrayList<Rating>();
InputStream fis = null;
BufferedReader br;
try {
fis = new FileInputStream(file);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
br = new ... |
2334a9f9-1295-456a-84b7-289e0f4e339c | 6 | public static Account constructAccountObject(String username) {
ResultSet result = accessAccount(username);
Account account = null;
try {
result.next();
String uname = result.getNString(1);
String pass = result.getNString(2);
int employee_id = result.getInt(3);
String employee_name = result.getNStr... |
6bec2dd6-abfe-41dc-901a-e7a69382f674 | 5 | private CalcState work(CalcState state) {
CalcState bestState = state;
for (int point2 = state.point1 + 1; point2 < conf.numPoints; point2++) {
Point p2 = new Point(Main.xFromPoint(point2), Main.yFromPoint(point2));
StringBuilder s = new StringBuilder();
s.append(M... |
62015022-05b4-4c60-aebb-633ec16efb61 | 7 | private void testInstanceRange_X(int range) {
((TimeSeriesTranslate)m_Filter).setInstanceRange(range);
Instances result = useFilter();
// Number of attributes and instances shouldn't change
assertEquals(m_Instances.numAttributes(), result.numAttributes());
assertEquals(m_Instances.numInstances() - M... |
8895c030-78a9-46e6-8082-53950f3c1424 | 2 | private void createTables(){
try{
con = DriverManager.getConnection(dbURL2);
st = con.createStatement();
// for loop iterate over all elements in the array and create the tables
for (String h : c){
String insert = "CREATE TABLE \"ME\"."+ h + "(CountryCode VARCHAR(5) NOT N... |
767d183c-54df-4285-a221-a532ebf320fd | 8 | public void move(int xa, int ya) {
if (xa != 0 && ya != 0) {
move(xa, 0);
move(0, ya);
return;
}
if (xa < 0) dir = 3;
if (ya < 0) dir = 0;
if (xa > 0) dir = 1;
if (ya > 0) dir = 2;
if (light(xa, ya, dir)) {
xa /= 2;
ya /= 2;
}
if (!collision(xa, ya)) {
x += xa;
y += ya;
}
} |
deeb3748-0198-462a-9f41-23e643566761 | 5 | public String pickUp(Room room)
{
if(room instanceof ItemRoom)
{
ItemRoom ir = (ItemRoom) room;
boolean bool = true;
for(int i = 0; i < 6 && bool; i++)
{
if(inv[i] == null)
{
inv[i] = ir.getItem();
this.lastSlotUsed = i;
bool = false;
... |
84dfa836-48e5-462a-8b57-aa4c4f4eced3 | 8 | private static boolean getUsedVersions(SSAUConstructorSparseEx ssa, VarVersionPair var, List<VarVersionNode> res) {
VarVersionsGraph ssuversions = ssa.getSsuversions();
VarVersionNode varnode = ssuversions.nodes.getWithKey(var);
HashSet<VarVersionNode> setVisited = new HashSet<>();
HashSet<VarVersion... |
3faf6595-cf31-45e3-9310-8cdcc642a13c | 9 | private synchronized void updateScore(double counter, int color, int i) {
// score how interesting this point is
if (smart_random_points_score[color][i] > 0)
smart_random_points_score[color][i] = 0.5 * counter + 0.5
* smart_random_points_score[color][i];
else
smart_random_points_score[color][i] = count... |
54cffa25-3c04-4f8a-a13b-c670fa5e1e1b | 5 | public static int[] bufferStringChunkUTF8(CharSequence s, int start, byte[] byteBuffer) throws IOException {
int bufferPos = 0;
int stringPos = start;
while (stringPos < s.length()) {
char ch = s.charAt(stringPos);
int encodingSize = utf8EncodingSize(ch);
if (... |
6a63f1c5-f4cb-4baf-bdeb-62ebba989cfe | 0 | public int getX(){
return xPos;
} |
32898206-ae53-4c43-ac0b-1edbc530db2f | 4 | public Rule[] Scan(String fileName)
{
try
{
InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
ArrayList<String> tempLines = new ArrayList<String>();
String line = "";
while((line = ... |
c71e819d-c99b-4447-b010-62134512bcdb | 9 | public boolean startDragComponent(Point p) {
clearDragState();
// which component is dragged ?
for(int i = 0; i < getTabCount(); i++) {
Rectangle tabbounds = getBoundsAt(i);
if(tabbounds != null && tabbounds.contains(p)) {
draggedDockable = (SingleDockableContainer) getComponentAt(i);
if(i > 2 && i... |
846573ae-b331-4ed7-bfe9-af36f3335d06 | 2 | private int spareBonus(Frame [] frame, int thisIndex, int frameNum) {
if (thisIndex < 9 && thisIndex + 1 > frameNum)
return -1;
return frame[thisIndex + 1].first;
} |
f99a91a2-faaa-48ab-b863-d519e6a95f97 | 9 | void run(){
int N = 150000;
Scanner sc = new Scanner(System.in);
boolean[] p = new boolean[N];
Arrays.fill(p, true);
List<Integer> l = new ArrayList<Integer>();
p[0]=p[1]=false;
for(int i=2;i<N;i++){
if(p[i]){
l.add(i);
for(int j=i+i;j<N;j+=i)p[j]=false;
}
}
for(;;){
int n = sc.nextIn... |
eb8bc79e-0adb-49db-adfb-3ff5612c2a92 | 2 | private static void writeTo(String outputFileName, ArrayList<String> lines)
throws IOException {
PrintWriter writer;
if (outputFileName == null) {
throw new IOException("No file has been loaded.");
}
writer = new PrintWriter(new FileOutputStream(outputFileName));... |
a5d9399f-3a84-4d7a-ba4f-7c9d08cf6952 | 0 | public Production getProductionForTransition(Transition transition) {
FSATransition trans = (FSATransition) transition;
State toState = trans.getToState();
State fromState = trans.getFromState();
String label = trans.getLabel();
String lhs = (String) MAP.get(fromState);
String rhs = label.concat((String) M... |
ad9e40d3-4338-4fc0-9f02-3d29f76ba263 | 7 | public Piece.TypePiece askPromotion(ChessGame G){
String L = null;
Piece.TypePiece type = Piece.TypePiece.P;
System.out.println("Write the piece you want(one character) :");
System.out.println("\"P\" : Pawn");
System.out.println("\"B\" : Bishop");
System.out.println("\"N\" : Knight");
System.out.println("... |
abae50c0-6b44-4d15-901a-7fe2190f0fe9 | 7 | private static int[] merge(int[] left, int[] right) {
// Lengths of both lists
int leftLength = left.length;
int rightLength = right.length;
int[] result = new int[leftLength + rightLength];
// Sets of indexes
int idx = 0;
int leftIdx = 0;
int rightIdx = 0;
// Goes through both lists (as long as th... |
5943143e-5db7-4f45-994a-745a450bee92 | 2 | public Song removeSong(String path) {
if(path == null || path.equals(""))
return null;
Song result= this.songMap.remove(path);
return result;
} |
57f7a33d-ca2a-431b-94b2-57584bb5a4cc | 1 | static public DalcSong getInstance() {
if (m_instance == null) {
m_instance = new DalcSong();
}
return m_instance;
} |
773ce3ab-0846-4588-bb2e-4cb4c8e2d48a | 0 | @After
public void tearDown() {
} |
2a5f2420-0d3e-4362-b37a-535433192838 | 2 | private ConvertiblePair getRequiredTypeInfo(Object converter) {
return ((Converter<?, ?>) converter).getConvertibleType();
} |
c7177958-ff2d-4beb-883a-c0b6bc7210dd | 6 | @Override
public long clean(long bytesToClean) {
if (isEmptyStorage()) return 0;
long cleanedBytes = 0;
for (Map.Entry<FileTime, File> fileEntry : cachedFiles.entrySet()) {
try {
final File oldFile = fileEntry.getValue();
final long fileSize = old... |
ede14383-6a25-487c-8fb5-38bee5bae333 | 0 | @Before
public void setUp() {
this.p = new Piste(0, 0);
this.e = new Este(0, 0, 10, 10);
this.t = new Taso();
} |
d4e00fd1-0fa5-4415-b586-b529384b90c6 | 3 | private static int loadShader(String path, int type)
{
StringBuilder source = new StringBuilder();
try
{
BufferedReader reader = new BufferedReader(new FileReader(path));
String line;
while ((line = reader.readLine()) != null)
{
... |
ee64fbdf-6c13-4fc0-a247-88a180c71d10 | 9 | void append(DNSIncoming that)
{
if (this.isQuery() && this.isTruncated() && that.isQuery())
{
if (that.numQuestions > 0) {
if (Collections.EMPTY_LIST.equals(this.questions))
this.questions = Collections.synchronizedList(new ArrayList(that.numQuestions)... |
30b8ae11-bd25-4dc1-9899-f3e0e8c47a5f | 1 | public PassengerTrain buildPassengerTrain() throws OutOfRangeException {
PassengerTrain res = new PassengerTrain();
res.clear();
Random rand = new Random();
res.add(new Locomotive.Creator().setHorsePowers(4400).setModel("ES44C4").setEngine("GEVO-12")
.setTonsWeight(126).setHeight(4.588).setComfortPerc... |
a9897749-a0ab-41e4-a34d-ded9857422db | 3 | private OBJIndex ParseOBJIndex(String token)
{
String[] values = token.split("/");
OBJIndex result = new OBJIndex();
result.SetVertexIndex(Integer.parseInt(values[0]) - 1);
if(values.length > 1)
{
if(!values[1].isEmpty())
{
m_hasTexCoords = true;
result.SetTexCoordIndex(Integer.parseInt(value... |
ed0c503d-de7a-4fa0-ac27-41d3e954360c | 3 | private void outputErrorDialog(JTextPane pane){
Scanner fileScanner;
System.out.println("Default Output Error File Path: " + outputErrorFilePath);
try {
if(!outputErrorFilePath.contains("src/")){
outputErrorFilePath = "src/" + outputErrorFilePath;
}
fileScanner = new Scanner(new FileInputStream(outpu... |
f8d09552-d767-4422-bfca-547fe94f5689 | 7 | public Double aStarSearch(Vertex[] vertices, int start, int goal) {
PriorityQueue<Vertex> vertexQueue = new PriorityQueue<Vertex>();
vertices[start].gScore = 0.0;
vertices[goal].isGoal = true;
vertexQueue.add(vertices[start]);
while (!vertexQueue.isEmpty()) {
Vertex current = vertexQu... |
b0444508-6f5b-4f0e-aa86-579ec4ac7d9b | 3 | private void drawtile(GOut g, Coord tc, Coord sc) {
Tile t;
try {
t = getground(tc);
// t = gettile(tc).ground.pick(0);
g.image(t.tex(), sc);
// g.setColor(FlowerMenu.pink);
// Utils.drawtext(g, Integer.toString(t.i), sc);
if (Config.tileAA) {
for (Tile tt : gettrans(tc)) {
g.image(tt.te... |
34c35657-7c26-4d84-bbe1-5d90bd595359 | 3 | public SEccl(String arg, Int i) {
i.incr(); /* skip over '[' */
if (i.get()>=arg.length())
throw new RESyntaxException("pattern ends with [");
if (arg.charAt(i.get()) == RE.NEGCCL) {
negate = true;
i.incr();
}
// Expand the range
doDash(arg, i);
if (arg.charAt(i.get()) != RE.CCLEND)
throw... |
6e5d380f-c9f7-4b9e-8357-327a3599bcce | 2 | public void loadConfigFiles() {
try {
loadRoomConfig();
loadBoardConfig();
cellXSize = (BOARDDIMENSIONX)/numColumns;
cellYSize = (BOARDDIMENSIONY)/numRows;
} catch (BadConfigFormatException b) {
new BadConfigFormatException(b.getMessage());
} catch (FileNotFoundException e) {
new BadConfigFormat... |
f6fea0dd-a6b7-4821-a0dd-0cd2678c2bd1 | 4 | void passf2(int ido, int l1, final double cc[], double ch[], final double wtable[], int offset, int isign)
/*isign==+1 for backward transform*/
{
int i, k, ah, ac;
double ti2, tr2;
int iw1;
iw1 = offset;
if(ido<=2)
{
for(k... |
64eaefe3-0f97-4886-b04e-68f1d48d82eb | 0 | private Manufacturer(int id, String name) {
this.id = (byte) id;
this.name = name;
} |
0ad05bc2-381f-4d19-b4b3-6ddd85dc5793 | 0 | @SuppressWarnings("rawtypes")
public void setValidator(Validator validator) {
this.validator = validator;
} |
39b4f5a2-4d1a-40ed-b3f4-84c8e78a1599 | 7 | public void bombbrick(int c, int r) {
// The number of bricks removed (the effectiveness of the bomb) depends on level
int remove;
if (level == 1)
remove = 2;
else
remove = 1;
// Makes bricks invisible
for (int i = c - remove; i <= c + remove; i++) {
for (int j = r - remove; j <= r + remove; ... |
10a6fbf7-af3c-4db4-b5e5-32adbc0a7a03 | 4 | public void addDefault(String node, String value) {
boolean flag = false;
this.pattern = Pattern
.compile("^<node=\"([-_a-zA-Z,._\\/0-9]{1,})\">([-a-zA-Z,._\\/0-9\\s]{1,})<\\/node>");
String tmp = "";
for (String line : this.getConfigFileLines()) {
this.matcher = this.pattern.matcher(line);
if (this.m... |
c9d9d7f0-4422-4be4-a9b9-e798a54c8799 | 0 | protected void setWindowSize(int _width, int _height) {
this.width = _width;
this.height = _height;
updateAspectRatio();
} |
ad53c4d4-e718-4d8f-953d-d9dec8af8684 | 1 | private static void readHeader(ObjectInputStream ois, int[] header) throws IOException
{
for(int i = 0; i < 128; i++)
{
header[i] = ois.readInt();
}
textLength = ois.readInt();
} |
f639cd7e-90e8-463d-9fc4-679252f2d0a0 | 9 | public OBJModel(String fileName)
{
m_positions = new ArrayList<Vector3f>();
m_texCoords = new ArrayList<Vector2f>();
m_normals = new ArrayList<Vector3f>();
m_indices = new ArrayList<OBJIndex>();
m_hasTexCoords = false;
m_hasNormals = false;
BufferedReader meshReader = null;
try
{
meshReader = ne... |
f3794987-2eea-44fe-a60d-ad949a24f7eb | 4 | protected void Update(double timeDelta)
{
m_elapsedTime = (m_currentTime - m_startTime) / 1000.0f;//time, in seconds, since creation of GameForm
m_currentFPS = Math.floor(1000.0 / timeDelta);//estimated FPS at this instant in time, rounded down
if (IsKeyTriggered(KeyEvent.VK_F11))//toggle fullscreen
{
m_... |
ef0e4cc7-a464-47cb-9e2f-544e1149cb2e | 5 | void updateCamera() {
if (KeyInput.isKeyDown(Keyboard.KEY_UP )) pushCamera(-1, 1) ;
if (KeyInput.isKeyDown(Keyboard.KEY_DOWN )) pushCamera( 1, -1) ;
if (KeyInput.isKeyDown(Keyboard.KEY_RIGHT)) pushCamera( 1, 1) ;
if (KeyInput.isKeyDown(Keyboard.KEY_LEFT )) pushCamera(-1, -1) ;
//if (KeyInput.isK... |
1a8f6b64-54a1-4b8a-9bc5-e8bfd8d0c1d0 | 1 | public void visit_freturn(final Instruction inst) {
stackHeight -= 1;
if (stackHeight < minStackHeight) {
minStackHeight = stackHeight;
}
} |
8eaa682d-1dff-4cd9-9ccf-b72f3b7ea46e | 2 | public int getInt(int index) throws JSONException {
Object object = this.get(index);
try {
return object instanceof Number ? ((Number) object).intValue()
: Integer.parseInt((String) object);
} catch (Exception e) {
throw new JSONException("JSONArray[" ... |
5b45b460-2693-4d4e-83dd-96b9c1616426 | 0 | @Override
public String toString()
{
return String.format( "annotatedWith(%s)", this.annotationType.getName() );
} |
6e29a367-2c72-4876-8ee1-9607c0a4e618 | 9 | public void actionPerformed(ActionEvent e)
{
try
{
if (e.getActionCommand().equals("Scout"))
{
//Creates an instance of the scout frame
ScouterScreen a = new ScouterScreen();
//Hide the page
this.setVisible(fa... |
3374c261-01e2-44e3-96d0-eb5d663364ff | 9 | public void backTrack() {
boolean tmpCounter = false, skipCounter = false;
for(int i = closedNodes.size()-1; i >= 0; i--) {
skipCounter = false;
for (Node tmpDead : deadEndList) {
if((closedNodes.get(i).compareTo(tmpDead))==1){
skipCounter = true;
break;
}
}
if(skipCounter==false) {
... |
6b9fd344-10bd-4d3c-8f5b-44bcb4d7c678 | 8 | public boolean pass(int[] bowl, int bowlId, int round,
boolean canPick,
boolean musTake) {
counter++;
if(counter==1){
for(int i=0;i<12;i++){
bowSize+=bowl[i];
}
//update(bowSize*6);
}
update(bowl,bowlId,round);
... |
23711fdb-83e5-4ded-beef-369d434ca140 | 4 | public void updateTarget(Target moveTarget) {
final Target oldTarget = trueTarget ;
this.trueTarget = moveTarget ;
if (trueTarget != oldTarget) {
if (verbose) I.sayAbout(mobile, "...TARGET HAS CHANGED: "+trueTarget) ;
path = null ; stepIndex = -1 ; return ;
}
else if (inLocus(nextStep())... |
ff146f31-4d5d-41bb-bc4b-57767f82d84b | 2 | public void run ()
{
while (directory_prefix != null) {
// No matter how we learn that something may have
// changed, we do the same thing to figure out
// exactly what changed: scan usbdevfs
scanForDevices(matchUSBvendorID,matchUSBproductID);
//while (scan ())
// continue;
try {
... |
29611b37-7109-47d2-a82c-ada5913fa367 | 2 | static public void main(String args[]) throws Exception {
if (args.length <= 0) {
System.err.println("Usage: java MultiPortEcho port [port port ...]");
System.exit(1);
}
int ports[] = new int[args.length];
for (int i = 0; i < args.length; ++i) {
port... |
e4ce9a91-956e-4b7b-9e89-824fa879aaa3 | 2 | @Override
public void setAccounting(Accounting accounting) {
counterParties = (CounterParties)accounting.getBusinessObject(CounterParties.COUNTERPARTIES);
statements = (Statements)accounting.getBusinessObject(Statements.STATEMENTS);
accounts=accounting==null?null:accounting.getAccounts();
journals=accounting==... |
82fb33e3-a737-4545-baad-17517cffcb96 | 0 | public Help() {
setTitle("AYUDA");
setIconImage(Toolkit.getDefaultToolkit().getImage(Help.class.getResource("/InterfazGrafica/Images/1416396005_FAQ.png")));
setBounds(10, 50, 836, 739);
setLocationRelativeTo(rootPane);
setModal(true);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBackgro... |
88e2b765-fa73-4cf1-a6df-6b2a174cd808 | 9 | private void parse() throws MalformedUriException, MalformedDomainException {
int colon = string.lastIndexOf(':');
if (string.charAt(0) == '[') {
int bracket = string.indexOf(']');
if (bracket < 0)
throw new MalformedUriException(string, "Unmatched escape bracket ... |
67872f33-9aa0-461e-a36e-9e6f2705f2be | 9 | private void doGenBackbonesHelper(String runName, int numMutable, int strandMut[][], double theta, double alpha,
int numSteps, Backbone bb, double initFi[], double initPsi[], PrintStream logPS, int curRes){
if (curRes==numMutable){//we have a full backbone conformation, so output
outputBB(logPS, numMutable,... |
b249f7a3-5fde-46f3-a774-7a2649cdd7db | 2 | public static boolean check_variable_name_repeat(Variable_table variable_table, String name) {
for (int i = 0; i < variable_table.variable_name.size(); i++) {
if (variable_table.variable_name.get(i).toString().equals(name)) {
return false;
}
}
return true;... |
ea2488b2-00c2-4b08-96c5-5a67a197a103 | 1 | public void date() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMM");
try {
Date date = dateFormat.parse(monthDate);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.add(Calendar.MONTH, -1);
lastMaxDay = cal.getActua... |
3bc8384a-6e0b-4e7d-a013-f4c141fa10eb | 8 | public Job(int id, int tempoDeProcessamento, int requisicoesES, int acessoArquivos, int instanteDeChegada, ArrayList<Arquivo> arquivos) {
this.id = id;
this.instanteDeChegada = instanteDeChegada;
this.tempoDeProcessamento = tempoDeProcessamento;
this.requisicoesES = requisicoesES;
this.acessoArquivos = acesso... |
ca44e9b1-e427-492e-b3d8-03406dacc357 | 8 | public static boolean areCompatiable(Width lhs, Width rhs) {
return lhs == rhs || (lhs == Width.ScalarDouble && rhs == Width.Quad)
|| (lhs == Width.Quad && rhs == Width.ScalarDouble)
|| (lhs == Width.ScalarSingle && rhs == Width.Long)
|| (lhs == Width.Long && rhs == Width.ScalarSingle);
} |
da7e4b90-757d-4779-a12e-38a69549189b | 1 | @Override
public boolean createGame(Date date, Member memberOne, Member memberTwo) {
Game game = new Game(date, memberOne, memberTwo);
List<Game> games = getAllGames();
games.add(game);
try {
serializeObjectToXML("Games.xml", games);
} catch (Exception e) {
// TODO Auto-generated catch block
e.... |
9447dbd4-3adc-47ac-9a6f-9f3375c38a1f | 8 | private void unfilterPaeth(byte[] curLine, byte[] prevLine) {
final int bpp = this.bytesPerPixel;
int i;
for (i = 1; i <= bpp; ++i) {
curLine[i] += prevLine[i];
}
for (int n = curLine.length; i < n; ++i) {
int a = curLine[i - bpp] & 255;
int b... |
1459d9ff-cabc-4b35-a919-be2071ec7ed0 | 7 | public String decodeData(List<Integer> data) {
wbDecoding = new HashMap<Integer, String>();
wbEncoding = new HashMap<String, Integer>();
StringBuffer rv = new StringBuffer();
List<StringBuffer> cache = new LinkedList<StringBuffer>();
int nextIndex = 256;
for (int i : data) {
if (i < 256) {
wbEn... |
79e48e4f-cf9d-4f20-8a4e-5a7d7d9fbc13 | 4 | public void unpauseAll(){
if (paused.size() == 0) return;
// Continue all paused sounds:
for (Map.Entry<String, Integer> entry : paused.entrySet()){
if (entry.getValue() > 0){
// Sound was looping for n-times:
sounds.get(entry.getKey()).getAudioClip().... |
d5c25484-d56d-498c-a453-203084361a18 | 3 | @Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(RouteRestService.class);
//::::::::::::::::::::::::::::::::
//:: Setting the Property classes
//::::::::::::::::::::::::::::::::
DBProperties.setProperties();
RouteProperties.setProperties();
Adm... |
abef7d84-157c-452a-8802-5812b745231d | 6 | static public String ParseSrcPos() {
if (str.charAt(0) != '(' || str.charAt(str.length() - 1) != ')') {
return null;
}
if (str.length() >= 3) {
String srcpos = str.subSequence(1, 4).toString();
if (ParsePosition.IsPos(srcpos)) {
str = str.subSequence(4, str.lengt... |
a692f076-97e1-4cff-9509-83c989c2f796 | 1 | public boolean hasNoJumps() {
return successors.size() == 0 && predecessors.size() == 0;
} |
204fa5b7-64e1-4db4-824e-3ffe79d96a71 | 6 | public void fusionLayers() {
if (fusionArea.isEmpty()) {
return;
}
mergeOpacityBuffer(curColor, false);
fusion.clear(fusionArea, 0x00ffffff);
boolean fullAlpha = true, first = true;
for (CPLayer l : layers) {
if (!first) {
fullAlpha = fullAlpha && fusion.hasAlpha(fusionArea);
}
if (l.visi... |
5d9b7636-fc67-420e-8b0d-6d34984974e7 | 9 | public final void listaDeTipos() throws RecognitionException {
try {
// fontes/g/CanecaSemantico.g:339:2: ( ^( TIPOS_ ( tipo )* ) )
// fontes/g/CanecaSemantico.g:339:4: ^( TIPOS_ ( tipo )* )
{
match(input,TIPOS_,FOLLOW_TIPOS__in_listaDeTipos1125); if (state.failed... |
18d45f98-c52b-4d6c-8112-a7dd938bedf3 | 0 | public String[] parseMessage(Message msg){
return msg.getContent().split(":");
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.