method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
42343634-fee7-47fc-ac39-cab63d27e9f3 | 5 | public Object nextEntity(char ampersand) throws JSONException {
StringBuffer sb = new StringBuffer();
for (;;) {
char c = next();
if (Character.isLetterOrDigit(c) || c == '#') {
sb.append(Character.toLowerCase(c));
} else if (c == ';') {
... |
c7cd4feb-4d7f-48e8-a812-1abf311e61fd | 1 | public void prevValue() {
value--;
if (value < 0) {
value = values.length -1;
}
} |
e4bea799-39eb-48e1-9e6a-49c4a87a29f5 | 2 | public Extracciones(String ruta)
{
this.BDextracciones = new BD(ruta);
this.idProyecto = new ArrayList<Integer>();
this.proyectos = new ArrayList<Extraccion>();
int[] totalExtracciones;
File bd = new File(ruta);
if(bd.length() > 2000)
{
tot... |
cce1d65e-0c7d-43a8-9ecb-151d40e96b47 | 5 | protected Map<String, Object> parseProperties( DataStructure parent ) throws IOException {
// Properties format:
//
// properties ::= '(' (key '=' value)* ')'
//
// the first ( has already been read by now
Map<String, Object> result = new LinkedHashMap<String, Obje... |
8b98b02b-f2c3-4f6d-a474-d49f8df54cdd | 7 | @Override
public void anyActionPerformed(AnyActionEvent ev) {
try {
if (ev.isAnyOf(referToOthers)) {
referToOtherConnectors();
} else if (ev.isAnyOf(searchFile)) {
chooseClasspath();
} else if (ev.isAnyOf(searchDriver)) {
ch... |
b9beccba-89d7-4946-9940-e9e9e249d309 | 2 | public static synchronized String createGame(String rules, User user) {
for (GameRoom room : briscaGames) {
// if(room==null)continue;
if (!room.isBeenPlayed()) {
String roomname = ((rules.split(GameSocketServer.ROOMNAMEKEY)[1])
.split(",")[0]);
roomname = ManagerSocketServer.sanitizeWord(roomname... |
0f31c335-ee8a-47f2-b162-f2c855012f2a | 6 | private void drawNorth(Terrain[][] currentBoard,
Entities[][] currentObjects, Graphics g) {
Location playerDir = boardState.getPlayerCoords();
for (int i = 0; i < currentBoard.length; i++) {
for (int j = 0; j < currentBoard[0].length; j++) {
//Isometric formula for x, i *0.5 * Width - j * 0.5 * Width, inc... |
db43435e-2a09-4cdd-8f3a-042ca4478d7d | 4 | @Override
public List<LogProfile> getLogFileNames() throws RemoteException {
List<LogProfile> logs=new LinkedList<LogProfile>();
try {
Session session=this.conn.openSession();
String cmd="ls -l "+this.home+"/logs";
session.execCommand(cmd);
InputStream stdout=new StreamGobbler(session.getStdout());
... |
aceda582-9045-4bab-adde-6e4ac16976c5 | 7 | protected RawModel generateTerrain(Loader loader, String heightMap)
{
if (heightMap == null) return null;
BufferedImage image = null;
try {
image = ImageIO.read(new File("res/"+heightMap+".png"));
} catch (IOException e) {
e.printStackTrace();
}
int VERTEX_COUNT = image.getHeight();
int count... |
73816557-a1d4-491e-bb68-dbc2b8fe5e10 | 1 | public void imprimir() {
for (int j = 0; j < ListToken.size(); j++) {//ahora imprimiremos las personas de nuestro ArrayList
System.out.println("============================================================");
Nodo persona = (Nodo) ListToken.get(j);
System.out.println("Lexico: ... |
c6b068ba-6185-4105-84ad-5a5968dff5ee | 5 | public int[] getColumnInt(int colNum)
{
int nRows = 0;
int i = 0;
int[] ret;
if(colNum > 0){
try {
//get amount of rows
while(result.next()){
nRows ++;
}
//Check if there is more then 0 rows
if(nRows == 0)
return null;
ret = new int[nRows]; //create the Intarray with the no... |
6ebf4628-062a-4056-a2db-2fedae850c90 | 9 | public Args parse(String [] arguments) throws InvalidParameterException{
Args args = new Args();
if(arguments == null || arguments.length <= 0){
throw new InvalidParameterException("arguments is empty");
}
if(arguments.length < 2){
throw new InvalidParameterExcept... |
33d70d09-0855-4cce-9cdb-20fbf9650aae | 7 | private static void displayMutualInformation (double[][] density, int numGridLines) {
double mutualInfo = 0.0;
// Calculate marginal probability in x1 direction
ArrayList<Double> x1MarginalProb = new ArrayList<Double> ();
for (int x1Ind = 0; x1Ind < numGridLines; x1Ind++) {
Double margProb = 0.0;
... |
39fea89d-4946-458e-b499-697ee44a45dc | 9 | private boolean tryInsertIntoChain(final int chainNumber, long key) {
int chainDisplacement = primaryIndex.getChainDisplacement(chainNumber);
//try to store record in main bucket
int pageToStore;
final int keySignature;
if (chainDisplacement > 253) {
return storeRecordInMainBucket(chainNumbe... |
53967c73-ddd7-4c77-b826-abb237c9925d | 6 | @Test
public void testCodageNRZ() {
float min = 0;
float max = 4;
src = new SourceFixe("1");
ena = new EmetteurNumeriqueAnalogique(min, max, 4, TypeCodage.NRZ);
src.connecter(ena);
try {
src.emettre();
ena.emettre();
} catch (InformationNonConforme e) {
}
int i = 0;
while(i < ... |
905292e4-d6d6-4b45-a99c-7eb92996ad17 | 8 | public static int maxSum(int a[], int start, int end) {
int maxSum = 0;
// Trivial cases
if (start == end) {
return a[start];
} else if (start > end) {
return 0;
} else if (end - start == 1) {
return a[start] > a[end] ? a[start] : a[end];
} else if (start < 0) {
return 0;
} else if (end >= a.... |
860de803-cb41-4bef-93eb-a059168d6ec2 | 2 | public void inv_mdct(float[] in, float[] out, int block_type)
{
float[] win_bt;
int i;
float tmpf_0, tmpf_1, tmpf_2, tmpf_3, tmpf_4, tmpf_5, tmpf_6, tmpf_7, tmpf_8, tmpf_9;
float tmpf_10, tmpf_11, tmpf_12, tmpf_13, tmpf_14, tmpf_15, tmpf_16, tmpf_17;
tmpf_0 = tmpf_1 = tmpf_2 = tmpf_3 = tmpf_4 = tmpf... |
f04b964b-5b3e-4b87-9393-e638c01a612c | 2 | @Override
public void setState(IState state) {
if (this.state != null && this.state.equals("Rolling")){
this.state.getStatus();
this.state = state;
}
else
this.state = state;
} |
4eb9c0f8-5118-4236-b4b3-54299ddf6fed | 3 | public static void duped(int[] array) {
Set<Integer> set = new HashSet<Integer>();
boolean noDuplicates = true;
for (int i = 0; i < array.length; i++)
if (!set.add(array[i])) {
System.out.println("duplicate");
noDuplicates = false;
break;
}
if (noDuplicates)
System.out.println("no duplicate... |
cd0c263e-0d6f-47d5-bd46-82bc88e8ece0 | 7 | void test1()
{
try
{
Reader in = new StringReader(
"<p><UL><LI> left terms and list operators (leftward)</LI>\n"+
"<LI> left -></LI>\n"+
"<LI> nonassoc ++ --</LI>\n"+
"<LI> right **</LI>\n"+
"<LI> right ! ~ \\ and unary + and -</LI>\n"+
"<LI> left =~ !~ </LI>\n"+
"<... |
e2a78a6c-d523-436a-b0ec-6d8f43fc749e | 7 | private Dimension layoutSize(Container target, boolean preferred)
{
synchronized (target.getTreeLock())
{
// Each row must fit with the width allocated to the containter.
// When the container width = 0, the preferred width of the container
// has not yet been calculated so lets ask for the maximum.
int ... |
05f3a3f7-93a2-40b2-9008-ed8c006c7073 | 0 | public void setStepToVictim(Scanner scanner) {
this.stepToVictim = Input.getPositiveNumber(scanner, "Enter step of Victim");
} |
adee90cf-56ea-4c37-8764-d876bc7c0fb7 | 6 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.BLUE
+ "-----------------------------------------------------");
sender.sendMessage(ChatColor.GOLD + "Developed by: "
+ ChatColor.GRAY +... |
3682f59b-c109-409b-bf9d-42b768b6ad2b | 2 | public void tick(Map currentMap){
Random random = new Random();
double headM = (random.nextDouble()-.5)/10;
if(headM > .02 || headM < -.02){
heading += headM;
}
vel += (random.nextDouble()-.4)/100;
move(currentMap);
vel=vel%8;
stats.tick(0);
} |
16f71b3a-09ec-44cc-a912-723982dae131 | 1 | private HashMap<Integer, Double> getSubFitness(int bottom, int top) {
HashMap<Integer, Double> result = new HashMap<Integer, Double>();
for(int i = 0; bottom < top; i++){
result.put(i, fitness.get(bottom));
bottom++;
}
return result;
} |
122f2241-ed91-4965-b839-6fe809368fb9 | 2 | public boolean casesEqual(ContentCase... cases) {
ContentCase c0 = cases[0];
for (ContentCase c : cases) {
if (c.isEqual(c0)) {
c0 = c;
} else
return false;
}
return true;
} |
c18eceea-fe87-4c0f-b958-bfa240cdd1f4 | 1 | @Test
public void throwInvalidBudgetTypeExceptionWhenBudgetTypeIsNotEqualToAnnualOrMonthlyBudget() throws Exception {
try {
budgetFactory.requestBudgetByType("TEST");
fail("Budget Type is not valid.");
} catch (InvalidBudgetTypeException e) {
assertEquals("Invali... |
68433cb0-b2d8-48d0-a168-d6dd694d04e7 | 2 | private ItemStack[] importEnderchest(CompoundTag tag)
{
ItemStack[] inv = new ItemStack[27];
for (Tag t : ((ListTag) tag.getValue().get("EnderItems")).getValue())
{
int slot = ((ByteTag) ((CompoundTag) t).getValue().get("Slot")).getValue();
if (slot < 36)
{
inv[slot] = CraftItemStack.asBukkitCopy... |
298c5f3e-bcbd-4b0a-b49d-b742992b1769 | 7 | public static final int getBossRate(byte village) {
switch (village) {
case 0:
case 1:
case 2:
case 3:
return 10;
case 4:
return 20;
case 5:
return 12;
case 6:
retu... |
1906a44e-87ed-4dce-9bc4-e9836a9f2236 | 2 | public ISound createSound(String path) {
if(getExtension(path).equals("wav")) {
return new SoundWAV(path);
}
else if (getExtension(path).equals("mid")){
return new SoundMidi(path);
}
else {
return null;
}
} |
c5fa7d8e-ba6e-4f1c-aa55-ccb5ed31221b | 0 | public int getN() {
return n;
} |
562401cd-a388-4403-8968-293a8db1035e | 3 | public static String create(mxICell cell)
{
String result = "";
if (cell != null)
{
mxICell parent = cell.getParent();
while (parent != null)
{
int index = parent.getIndex(cell);
result = index + mxCellPath.PATH_SEPARATOR + result;
cell = parent;
parent = cell.getParent();
}
}
... |
e1cc8d7f-8b46-4641-b5b1-e945b9701909 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RoverPosition that = (RoverPosition) o;
return !(xPosition != null ? !xPosition.equals(that.xPosition) : that.xPosition != null) && !(yPosition != null... |
209eb6e0-56be-44f0-9640-bb337fe7b1ed | 1 | public Boolean equals(Gaussian that) {
return this.a == that.a && this.b == that.b;
} |
6596bc9e-f5b2-4aea-9bd6-05b4837b586b | 7 | public void run()
{
try {
Socket socket = new Socket("localhost", 5100);
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
DataInputStream in = new DataInputStream(socket.getInputStream());
String cmd = in.readUTF();
String name = cmd.split(":")[1];
System.out.println(cmd);
... |
b9c96ce6-92c7-452a-b720-ab4daeec319e | 4 | private static boolean isLocalMax(double[] frequencyData, int i) {
if (i - 1 < 0 || i + 1 >= frequencyData.length)
return false;
double left = frequencyData[i - 1];
double mid = frequencyData[i];
double right = frequencyData[i + 1];
if (right < mid && mid > left)
return true;
return false;
} |
3b5cc10c-eb08-451f-af9b-b17bf51811ec | 5 | public static Method getMutator(Class<?> declaringClass, String mutatorName, Class<?> argument)
{
Method res = null;
if (declaringClass != null)
{
// check this class
try
{
res = declaringClass.getDeclaredMethod(mutatorName, argument);
}
catch (NoSuchMethodException e)
{
// do nothing, ... |
2e271115-b601-4361-9024-a688db56967e | 0 | @Override
public int getID() {
// TODO Auto-generated method stub
return 0;
} |
daab9952-980e-487e-b469-09c0caa0254d | 0 | public static void closeNew() {
DIALOG.dispose();
DIALOG = null;
} |
a5581a59-c5a0-4288-b75e-dc1438cc3fab | 5 | public Point getTileCollision(Sprite sprite,
float newX, float newY)
{
float fromX = Math.min(sprite.getX(), newX);
float fromY = Math.min(sprite.getY(), newY);
float toX = Math.max(sprite.getX(), newX);
float toY = Math.max(sprite.getY(), newY);
// get the tile loca... |
d6ba980d-d8d7-4e86-b76d-3b3b763a909a | 3 | public static long addAddress(Address address, long sessionID) throws SessionException {
if (sessionID <= NO_SESSION_ID) {
throw new SessionException("A valid session ID is required to add an address",
SessionException.SESSION_ID_REQUIRED);
}
Contact contact = (Co... |
82fdb53a-efab-4874-be66-1368c6e590cc | 9 | public static AsciiImage getHistogram(AsciiImage img) {
HashMap<Character,Integer> freqMap = new HashMap<Character, Integer>();
String oldCharset = img.getCharset();
String newCharset;
newCharset = oldCharset;
for(int i = 0; i<=9; i++) {
if (oldCharset.indexOf(i + '0... |
45c6259d-f36e-47a2-9ad2-d1daba3d7371 | 8 | public SimpleEntry<URLConnection, String> GET(String url) throws IOException {
int redirects = 0;
SimpleEntry<URLConnection, String> r;
do {
r = cookies(LLHttpClient.GET(proxy(), url, connectTimeOut, readTimeOut, headers()));
url = check(r.getKey());
redirects++;
} while (follow && u... |
43abe313-622d-4869-b3ec-7c988a3844f3 | 7 | public MyRecord search(String name){
Node node=root;
MyRecord result=null;
//when node isn't leaf, find the record in the node, or find the right next level node to search
while(!node.isLeaf()){
int flag=0;
for(int i=0;i<node.getKeys().size();i++){
if(node.getKeys().get(i).getName().compareTo(name)==0... |
8e186da9-ee14-4ee3-86fb-0c824a3e9d3f | 2 | public ArrayList<Location> getValidAdjacentLocations(Location loc)
{
ArrayList<Location> locs = new ArrayList<Location>();
int d = Location.NORTH;
for (int i = 0; i < Location.FULL_CIRCLE / Location.HALF_RIGHT; i++)
{
Location neighborLoc = loc.getAdjacentLocation(d);
... |
d9af3291-1df3-4f1c-80d3-c2ee68c688ed | 7 | @Override
public void mouseClicked(MouseEvent arg0) {
//System.out.println(arg0.getSource().toString());
if (status == VideoStatus.PLAYING){
pause();
}
int videoIndex = ((MyPanel)arg0.getSource()).videoIndex;
if(videoIndex != currentVideo){
currentVideo = videoIndex;
audio = new File(audio... |
9f6eccd8-c8ae-47d4-a8ce-570ef60eb8f1 | 1 | public boolean isObstacle()
{
return lookid == 1 || lookid == 3;
} |
3ed3adec-6831-4a15-a03a-5de9ad41d9a6 | 6 | public void renderTileEntitySignAt(TileEntitySign par1TileEntitySign, double par2, double par4, double par6, float par8)
{
Block var9 = par1TileEntitySign.getBlockType();
GL11.glPushMatrix();
float var10 = 0.6666667F;
float var12;
if (var9 == Block.signPost)
{
... |
a1db123b-932f-43d6-bd68-bc1510b30e48 | 1 | @Override
public void setAgility(int agi) {
if (agi >= 99) {// agility will be a % chance and must be < 100
this.agility = 99;
} else {
this.agility = agi;
}
} |
3a376104-cccd-46db-8f2b-0d457d52d01d | 7 | @Override
public Scanner scan(Lexer lexer) {
boolean terminated = false;
loop:
while (lexer.hasNext()) {
final char ch = lexer.next();
switch (ch) {
case '\\':
if (lexer.hasNext()) {
final char chn = lexer.ne... |
1a4e2d20-c4ed-438d-8c3e-9fc75b53dc9b | 5 | public int[][] paintImages(int[][] currentBlockArray, int xMin, int xMax, int zMin, int zMax) {
BufferedImage[] images = getPaintImages("Theme1");
int h = images[0].getHeight();
int w = images[0].getWidth();
int i = 0;
level = 0;
wipZMin = zMin;
wipHeight = h;
... |
34801571-0890-4dea-8a99-d919516560d4 | 9 | protected boolean connect(){
LCD.clear();
LCD.drawString("Bluetooth:", 0, 0);
LCD.drawString("Connect -> Enter", 0, 1);
LCD.drawString("Don't -> Esc", 0, 2);
LCD.refresh();
while(true){
if ( Button.ENTER.isDown() ){
while(Button.ENTER.isDown()){try {
Thread.sleep(1);
} catch (Int... |
e4c15a9c-543e-4153-b5a0-26c76e2a3993 | 6 | public List<SemestreDTO> getAllSemestres() {
List<SemestreDTO> semestres = new ArrayList<SemestreDTO>();
String sql = "select distinct(semestre) as semestre from calendario order by semestre desc";
PreparedStatement pst = null;
ResultSet rs = null;
Connection con =null;
try {
con = EscolarConnectionFacto... |
b852f2bf-b67b-422d-8090-a8426d0b4315 | 1 | FiguresChain(Map<String, Integer> figureQuantityMap) {
if (Objects.isNull(figureQuantityMap)) {
throw new IllegalStateException("figureQuantity map is null, however should not be");
}
this.figureQuantityMap = figureQuantityMap;
} |
7dd5a1a0-04b0-4338-b662-72b67bfb58d2 | 8 | @Override
public void createPartControl(Composite composite) {
composite.setLayout(new GridLayout(11, false));
Label label = new Label(composite, SWT.NONE);
label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
label.setText("文件");
fileText = new Text(composite, SWT.BORDER | SWT.REA... |
1e2863c7-319f-4837-a507-d73764cbf1bf | 7 | @Override
protected void _serialize(TagNode tagNode, Writer writer) throws IOException {
serializeOpenTag(tagNode, writer, false);
List<? extends BaseToken> tagChildren = tagNode.getAllChildren();
if ( !isMinimizedTagSyntax(tagNode) ) {
Iterator<? extends BaseToken> chil... |
e6f6bf47-0f18-4fc8-8052-08a1ae48d08d | 8 | public void run() {
System.out.println("run method running.");
while (true) {
String userCommand = this.readInputStream();
System.out.println("user command: " + userCommand);
String[] command = commandParser(userCommand.toLowerCase().trim());
if (!command[0].equals("close")) {
if (currentCommand.equ... |
d0d947b6-1264-4584-9ef4-e2c9e79acdd9 | 1 | @Override
public MessageResponse logout() throws IOException {
if(currentUser != null) {
currentUser.setOnline(false);
currentUser.getSubscriptions().clear();
currentUser = null;
return new MessageResponse("Successfully logged out.");
}
return new MessageResponse("You have to login first to perform t... |
8af4f298-c2c9-4d16-91b2-f33d2a1c9913 | 1 | private void buildBoard() throws GOLException, IOException {
initializeBoard();
int row = 0;
Scanner scanner = new Scanner(filePath);
while (scanner.hasNextLine()) {
fillBoardWithLine(scanner.nextLine(), row);
row++;
}
scanner.close();
} |
39af4cb6-5092-4b8c-8baa-258759a45c21 | 1 | @Test
public void shouldThrowErrorWhenFileIsNotSelected() {
//when
try {
FileParser fileParser = new FileParser(null);
fileParser.parse();
} catch (GOLException e) {
//then
String msg = "Bitte Datei auswählen.";
assertEquals(msg, e.... |
8900c5bb-5b7e-4abb-a1fa-89e6ac2236f3 | 2 | private Token getNextToken() {
Token token = tokenizer.getToken();
if ( token == null ) {
return null;
}
else if ( token.isError() ) {
throwException( "Input contains syntax error" );
}
return token;
} |
75e51945-62c4-401a-9c8d-ceec146b634b | 3 | private void setPolygon(boolean getPoly, Envelope env) throws JsonParseException, JsonMappingException, IOException{
@SuppressWarnings("unchecked")
//get json file paths for given extent
List<String> paths = jsonTree.query(env);
//reset/create new polygons array or new tree
if(getPoly)polygons = new Polygon[p... |
91084842-31d2-47e2-b176-93e6d436535d | 1 | public void addLogger(final Logger logger) {
if (logger == null) {
throw new NullPointerException();
}
loggers.add(logger);
} |
86a64f70-1944-4d87-8cf2-85de9f4b1671 | 7 | private Link maybeSwitch(Link link){
Link secondLink = linkQueue.peek();
if(link != null && secondLink != null){
if(
link instanceof BackLink &&
link.getRank() == secondLink.getRank()&&
!(secondLink instanceof ShortcutLink)){
... |
b40b3f5e-94d4-4804-a34a-0220eac45d13 | 3 | @Override
public void removeUpdate(DocumentEvent e) {
if(progress.isVisible()) {
progress.setVisible(false);
} else if(correct.isVisible()) {
correct.setVisible(false);
} else if(error.isVisible()) {
error.setVisible(false);
}
} |
18e9b3af-ba5a-42f2-9ace-1d403c1b1661 | 8 | private int alphabetaScore(GameState state, Color faction)
{
state = state.getCounter().score(state, false);
int playerScore = 0;
Color maxPlayer = null;
int maxScore = Integer.MIN_VALUE;
for(Player p : state.getPlayerList())
{
//determine the player's score
if(p.getFaction().equals(faction))
{... |
b2011f19-644b-413f-b116-2da08961f684 | 4 | static void split(BufferedReader br, String fileName, int count) {
int i = 0;
String line = null;
FileWriter fw = null;
BufferedWriter bw = null;
try {
fw = new FileWriter(fileName);
bw = new BufferedWriter(fw);
while ((line = br.readLine()) != null && i < count) {
line = line.substring(1, line.l... |
4715264a-b1d1-4377-84dc-3deb3aea860c | 1 | public boolean isWhiteWinner(){
boolean res = false;
if(this.blackPieces == 0){
res = true;
}
return res;
} |
3d3ad8d4-f804-49bb-941c-c1ce22951ab7 | 0 | private boolean isValidInput(final String s) {
return s.matches("[0-9]{1,}");
} |
41941ddc-8b19-40f3-a92f-e9152c2ae204 | 3 | public String encryption(String string, boolean decrypt,
SecurityManager securityManager) {
// get the security manager instance
if (securityManager != null && reference != null) {
// get the key
byte[] key = securityManager.getDecryptionK... |
27ed5ffe-b654-4f15-8c18-7759b71c6264 | 9 | protected double [] makeDistribution(Instances neighbours, double[] distances)
throws Exception {
double total = 0, weight;
double [] distribution = new double [m_NumClasses];
// Set up a correction to the estimator
if (m_ClassType == Attribute.NOMINAL) {
for(int i = 0; i < m_NumClasses;... |
09e273df-de5c-4224-969e-3517c864ec0c | 2 | public Tree(HuntField field) {
this.field = field;
this.type = 'T';
while (true) {
myPosition = field.randomPositionGenerator();
if (myPosition == null) {
field.setItem(this, myPosition);
break;
}
}
} |
73010aa2-9e8b-4270-9fe2-b4351e6829e6 | 3 | public List<Message> page(final int index) {
if (this.pageSize < 1) {
if (index != 0) throw new IllegalArgumentException("page index not available: " + index);
return this.contents;
}
final int last = ((index + 1) * this.pageSize) - 1;
ret... |
8411cc3d-dde1-4309-9754-4d88c8929205 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
final Location other = (Location) obj;
if (this.level != other.level && (this.level == null || !this.level.equals(other.level))) return false;
if (thi... |
86ebb4e9-c389-44b7-b656-524ff110de01 | 4 | @Override
public boolean onCommand(CommandSender sender, Command command,
String label, String[] args) {
if (args.length == 1 && args[0].equalsIgnoreCase("help")) {
showHelp(sender);
return true;
}
if (args.length == 1 && args[0].equalsIgnoreCase("reload")... |
18df7ab4-1065-4652-8200-e9239c425615 | 3 | public void interpretaComando(CoreComando comando, ServidorCliente cliente) {
switch (comando) {
case DIREITA:
cliente.getPosicao().setX(cliente.getPosicao().getX() + 5);
//setStateImg("");
break;
case ESQUERDA:
cliente.getPosicao().setX(cliente.getPosicao().getX() - 5);
//setStateImg("");
break... |
4f454143-f238-43fc-a7ef-005946288c75 | 1 | private boolean jj_3R_91() {
if (jj_3R_95()) return true;
return false;
} |
f8a87ac5-ed44-4a58-af30-43565bfb993d | 9 | private void btn_Guardar_UsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_Guardar_UsuarioActionPerformed
try {
if (txtID_Usuario.getText().compareTo("") != 0 && txtpass_usuario.getPassword().toString().compareTo("") != 0
&& txtdni_usuario.getText().co... |
55217f35-ac89-432a-982b-3c3b252ff2fe | 5 | @Test
@Points(value = 5)
public void checkThatGridPackingConstructorIsDoingTheRightThingInternally()
{
// ************************************************************************************
// Note: This isn't a standard test case to run in industry, but is a great test case
// for students who will encounter... |
0894cf1b-93ed-4b3d-97df-6a291e5a1dcb | 6 | private void addWordRec(CharNode parent, String word, int charAt, int occur) {
CharNode child = null;
char data = word.charAt(charAt);
if (parent.children == null) {
parent.children = new ArrayList<>();
} else {
for (int i = 0; i < parent.children.size(); i++) {
... |
95ff5275-aff1-4d28-b027-7dee60d7e7e7 | 5 | private void convertKosarak() throws IOException {
String thisLine; // variable to read a line
BufferedReader myInput = null;
try {
// Objects to read the file
FileInputStream fin = new FileInputStream(new File(input));
myInput = new BufferedReader(new InputStreamReader(fin));
int count = 0; // to... |
bbb27577-aa16-47d3-8277-56546d3de591 | 9 | private void authenticationExchange() throws IOException {
// _console.writeline("authenticationExchange");
int scheme = readCard32();
if (scheme == 0) {
String reason = readString();
throw new VNCException("connection failed: " + reason);
... |
396ab731-4899-4189-aec0-bb0f4ae34142 | 2 | private void jButtonCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonCheckActionPerformed
this.jTabbedPane.setSelectedComponent(this.jPanelTabQueue);
for (int i = 0; i < this.model.getRowCount(); i++) {
if (this.model.isSelected(i)) {
Signature... |
ba4bc09c-9b96-4532-875b-e91cd25bde8b | 1 | public int getLEShortA() { // method438
offset += 2;
int v = ((payload[offset - 1] & 0xff) << 8) + (payload[offset - 2] - 128 & 0xff);
if (v > 32767) {
v -= 0x10000;
}
return v;
} |
17414b4c-2fa7-4594-83bf-94fad2efa8a0 | 5 | private static int[] stringToIntArray(String str) throws Exception
{
int slength=str.length();
int retval[] = new int[(int) Math.ceil(slength / 4.0)];
for (int i=0; i<retval.length; i++) {
// note little-endian encoding - endianness is irrelevant as long as
... |
012e6417-c438-43dc-be36-fec8e84a75ea | 3 | public boolean matchByStateAndSymbol(String state, String symbol, Symbol symbolRef) throws Exception{
if(!this.state.equals(state))
return false;
if(this.symbol != null && !this.symbol.isEmpty())
return this.symbol.equals(symbol);
return matchSymbolbySym... |
02eca423-19c3-4086-9638-bed8ae5715b2 | 7 | public Object nextValue() throws JSONException {
char c = this.nextClean();
String string;
switch (c) {
case '"':
case '\'':
return this.nextString(c);
case '{':
this.back();
return new JSONObject(this);
... |
eab4906f-1f29-43e3-b786-1a3878b5bb80 | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
char[][][] letras=new char[][][]{
{{'A'},".-".toCharArray()},{{'B'},"-...".toCharArray()},{{'C'},"-.-.".toCharArray()},{{'D'},"-..".toCharArray()},
{{'E'},".".toCharArray()},{{'F'... |
36278146-8f73-4b2d-9c35-3c751e7d4b37 | 5 | public void setNextByAddr(FlowBlock flow) {
/* nextByAddr can be set, when reordering block in transform exc */
// if (nextByAddr != null)
// throw new IllegalStateException("nextByAddr already set");
if (flow == END_OF_METHOD || flow == NEXT_BY_ADDR)
throw new IllegalArgumentException("nextByAddr mustn't be... |
9a0e2daa-dae4-4e79-9cec-4ea1395d3267 | 0 | public OSCPacketDispatcher() {
} |
2579f9a2-6882-4479-a1ee-fa8c7da58b45 | 6 | private boolean setupCompleted() {
if (address.getText() == null || address.getText().trim().length() == 0) {
return false;
}
if (!loadGame) {
if (teamChoice.getSelection() == null) {
return false;
}
if (address.getText() == null
|| name.getText().trim().length() == 0) {
return false;
... |
ee06391a-ff53-4171-8c52-12931e743fe1 | 7 | public Builder temperature(int receivedTemperature) {
if (receivedTemperature > 25000) {
starClass = StellarClassification.O;
}
if (receivedTemperature <= 25000) {
starClass = StellarClassification.B;
}
if (receivedTemperature <... |
c709e2dd-2319-445e-a2c1-01fad3c47b35 | 1 | public static void main(String[] args) throws IOException {
ServerSocket server = new ServerSocket(2048);
while (!Thread.currentThread().isInterrupted()) {
Socket client = server.accept();
// new Thread(new ClientHanldler(client)).start();
service.execute(new ClientHanldler(client));
}
service.shutdo... |
45408e63-940f-4a57-af1c-624c06d4ccbc | 1 | public String toHtml(){
String ret=parentRow();
for(Object s:this.events){
ret+=((AuditEvent)s).toHtml();
}
return ret;
} |
adcd19bc-bf0f-45e4-afce-9d56da06aa3b | 9 | void implementMap()
{
props.add(Defaults.MAP_PROPERTY_COL);
returnTypes.add(Object[].class);
// add a dummy mutator
setters.add(null);
getters.add(null);
if (this.object != null)
{
// this should work:
// Set<?> entrySet =((Map<?,?>)object).entrySet();
// values.add(entrySet.toArray());
// un... |
ec9026af-c694-43b8-a389-5427277df7ca | 8 | private void moveForward(Orientation orientation) throws MovementInvalidException{
//TODO check MarsRover space and throw exception
switch (orientation) {
case NORTH:
if(marsRover.getMaxCoordenateY() > getCoordenateY())
setCoordenateY(getCoordenateY() + 1);
else
throw new MovementInvalidExcept... |
c1c7134b-a0de-4ed7-b2fb-bb1f86af026e | 1 | protected void removeChild( GraphItem item ) {
children.remove( item );
if( site != null ) {
site.removeItem( item );
}
} |
44eb4d68-3574-4ba7-ae23-ecbe4f0a990a | 3 | @Override
public List<Packet> onContact(int selfID, Sprite interactor, int interactorID, List<Integer> dirtySprites, List<Integer> spritesPendingRemoveal, ChatBroadcaster chatter) {
if (interactor instanceof Player) {
if (!((Player) interactor).isAlive())
return new ArrayList<Pac... |
541d5255-66c5-43a0-a209-572323ad984b | 2 | public Connection nearBaseStation() {
for (int i = 0; i < connections.getLength(); i++) {
Connection connection = connections.get(i);
if (connection.getType() != CoreType.BASESTATION)
return connection;
}
return null;
} |
45394b6a-cd45-48c3-9a3a-3d66f6382bcd | 7 | public void setData(int[][][] data, int demeCount) {
if(data.length==0 || demeCount==1)
return;
assert data.length * 2 == (demeCount * (demeCount - 1));
// first set deme labels...
xlabs =new String[data.length];
ylabs =new String[data.length];
int counter =0;
for (int i =0; i < demeCount; i++) {
fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.