method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
6a77be03-38c3-44f3-bc70-fe71adb74599 | 3 | public boolean equals(Object obj){
if(obj instanceof PathNode){
PathNode other = (PathNode) obj;
if(other.getX() == this.getX() &&
other.getY() == this.getY()){
return true;
}
}
return false;
} |
13e88e9e-67f1-4361-81ee-dc41a9ed6ae9 | 7 | @Override
public void update(GameContainer container, int delta)
throws SlickException {
Input input = container.getInput();
if(bumper.isBallConnected()){
ball.setPosition(bumper.getX() + ballOffsetX , bumper.getY() - ballOffsetY);
} else {
Vector2f ballDir = ball.getDirection();
ball.setX(ball.ge... |
ae58a65c-fd74-43ac-be05-b379cd41a153 | 7 | @Override
public boolean onCommand(CommandSender sender, Command arg1, String label,
String[] args)
{
boolean lock = true;
if (label.equals("sclock"))
lock = true;
else if (label.equals("scunlock"))
lock = false;
else
return false;
if (args.length != 1)
return false;
SharedChest sc = plug... |
c5db0869-1ad2-472f-a57f-01f6bc059b83 | 2 | public static void LoadAllSriptsToMenu() {
for (JSScriptInfo info : script_list.values()) {
if (!info.scrHide) info.AddStartMenuElement();
}
} |
be0009bd-97e9-4d65-9b7e-9c752afc1d70 | 7 | public boolean isValidCell(int row,int column, Grid grid) {
if (row < 0 || row >= grid.getNumRows()) return false;
else if (column < 0 || column >= grid.getNumColumns()) return false;
GridCell cell = grid.getCellAt(row, column);
if (cell.isSearched() && !canFlyOver) return false;
else if (cell.isOccupied()) r... |
8335cf5c-76da-482d-b150-aed04363c382 | 2 | private void createListTasks(ResultSet result){
try{
while(result.next()){
Task task = new Task();
task.setName( result.getString("jmeno") );
task.setStart( result.getString("cas_startu") );
task.setEnd( result... |
502be083-0c54-4be1-9ea6-277d10b48d2e | 6 | public static void main(String [] args) {
String filename= Demo.class.getClassLoader().getResource(TOPO_FILE).getFile();
AbstractScheduler scheduler= new Scheduler();
try {
Network network= NetworkBuilder.loadTopology(filename, scheduler);
for (Node n: network.getNodes()) {
System.out.println(n);
fo... |
92fc3a66-6fa7-43f4-a9e2-ed595fbde13c | 4 | private void createGUI() {
if (grid == null || grid.length == 0) {
System.out.println("You did not initialize the grid! You must "
+ "initialize the grid to run the puzzle!");
System.exit(0);
}
// Create the window.
JFrame.setDefaultLookAndFeelDecorated(true);
window = new JFrame("Column Puzzle");... |
9952de70-9e8a-4a62-bbb0-9e20bf6efdb8 | 0 | public void setQuestTimeout(int questTimeout) {
QuestTimeout = questTimeout;
} |
e74841bf-decc-4098-bcfb-43342e0bbae3 | 9 | @Override
public void execute(RPSAgent agent) {
if(agent.getServer() != null) {
agent.log("Arriving at " + agent.getServer().getId() + ", I decided to look around and see if I could find anyone willing to parttake in the tournament I had arranged.");
List<Agent> agents = agent.getSer... |
07c0fd99-ce81-4ad9-b647-3c6a82bada77 | 5 | public void checaColision() {
// BALON VS JFRAME
Rectangle cuadro = new Rectangle(0, 0, this.getWidth(),
this.getHeight());
if (!cuadro.intersects(balon.getPerimetro())) {
bVelx = 0;
bVely = 0;
balon.setPosX(100);
balon.setPosY(30... |
baa9b0c5-519d-46ad-8fb1-8e70266a3bcc | 4 | public static void main(String[] args) throws Exception {
if(args.length < 1) {
System.err.println("ERROR: USAGE SHOULD BE; <port> <max-players>");
System.err.println("Starting with default settings <5555> <2000> where 5555 is port & 2000 is max-players");
args = new String[] { "5555", "2000" };
}
for(St... |
7998df3b-2b6c-4bf3-a0da-02e774df1840 | 3 | public static boolean manhattan(int x, int y, int nextStation) {
switch (nextStation) {
case 1:
return (Math.abs(x - x1) + Math.abs(y - y1) > s1 - steps);
case 2:
return (Math.abs(x - x1) + Math.abs(y - y1) > s2 - steps);
case 3:
... |
428e5a27-0087-4f18-af8e-9fbe4012eddb | 7 | public void mixPalette(int red, int green, int blue) {
for (int i = 0; i < palette.length; i++) {
int r = palette[i] >> 16 & 0xff;
r += red;
if (r < 0)
r = 0;
else if (r > 255)
r = 255;
int g = palette[i] >> 8 & 0xff;
g += green;
if (g < 0)
g = 0;
else if (g > 255)
g = 255;
... |
fa3bb15a-91c8-4e30-983b-4717d70eefaa | 0 | @Override
public String getName() {
return name;
} |
df8cf979-1aa8-4b60-a794-50c3a6a7ba63 | 7 | public static void apply(int[][] input) {
Set<Integer> zeroRows = new HashSet<>();
Set<Integer> zeroCols = new HashSet<>();
for (int i = 0; i < input.length; i++) {
for (int j = 0; j < input[0].length; j++) {
if (input[i][j] == 0) {
zeroRows.add(i... |
fe9174ae-fc93-4312-8338-b49250f76d7b | 4 | public boolean findZeroEstimate(int k) {
for (int i = 0; i < msgs.length; i++) {
if (i != (pid - 1) && msgs[i] != null) {
if (msgs[i].getDeltaP()[k] == -1) {
return true;
}
}
}
return false;
} |
51ab6578-3af3-4cf2-8544-00c7991421c9 | 6 | public String addIsAttachedEdge(String resource_id, String inode_id, String region, String agent, String plugin)
{
String edge_id = null;
int count = 0;
try
{
while((edge_id == null) && (count != retryCount))
{
if(count > 0)
{... |
618643aa-bbf7-458f-9039-aa31c61db4a9 | 9 | private boolean compareStudentRecords(StudentRecord sr1, StudentRecord sr2) {
if(!sr1.getStudent().sameStudents(sr2.getStudent())) { // Student
return false; }
else if(sr1.getDepartment() != sr2.getDepartment()) { // Department
return false; }
else if(sr1.getDegreeSought(... |
4ff69d4b-a87e-496d-a391-7b1bf6ec928b | 5 | public void asignarImagen(String nombreImagen,int numeroRespuesta){
Imagen imagen = null;
String direccion ="/imagenes/"+nombreImagen;
switch(numeroRespuesta){
case 0: imagen = new Imagen(direccion,_jpnImagen1.getWidth(),_jpnImagen1.getHeight());
_jpnIma... |
4ca3b629-7373-42c5-8586-8d35bbad7a0a | 2 | public static void main(String[] args) {
try {
CycAccess cycAccess = CycAccess.getNewCycAccessInteractively();
if (cycAccess == null) {
System.exit(-1);
}
SubLInteractor interactor = new SubLInteractor(cycAccess);
final JFrame frame = new JFrame();
frame.setTitle("SubL In... |
6cbd6412-d9e2-4e6a-8ebb-930d372405ea | 8 | private static final Object bitCast(final Number o1, final Number o2, final long value) {
if (o1 instanceof Long || o2 instanceof Long) {
return value;
}
if (o1 instanceof Integer || o2 instanceof Integer) {
return (int) value;
}
if (o1 instanceof Short ||... |
d01dddf4-62ea-45a7-9f8f-44ef27d9211c | 4 | public static Collection<Message> translate(final ByteBuffer buffer, Client client)
{
//logger.info("Beginning Translate");
byte command;
byte[] lengthBytes = new byte[MESSAGE_HEADER_LENGTH];
byte[] data;
int length;
Message msg;
boolean processing = true;
Collection<Message> result = new ... |
f4c9eadd-8999-4ebb-9114-0d6c00b83afb | 6 | public static OS getPlatform() {
String osName = System.getProperty("os.name").toLowerCase();
if (osName.contains("win")) return OS.windows;
if (osName.contains("mac")) return OS.macos;
if (osName.contains("solaris")) return OS.solaris;
if (osName.contains("sunos")) return OS.solaris;
if (osName... |
e117d2ee-4b15-4399-bbf8-66497d5896e3 | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
c1623f6c-78a6-4e82-a60c-8090d6c3ce19 | 2 | public static void main(String [] args) {
int sum = 0;
int i = 0;
int x = 0;
while( x < 4000000 ) {
x = fib(i);
if( x % 2 ==0) {
sum += x;
}
i++;
}
System.out.println(sum);
} |
442f722e-1766-412a-9d77-3d56f875eeeb | 0 | public void setReadyLocation(Location ready) {
this.ready = ready;
} |
a50371cb-8dbd-4a59-8d67-e66560bc0ff8 | 6 | public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if(aValue != null){
Message Msg = ListMsg.get(rowIndex);
MessageDAO MsgDAO = new MessageDAO();
switch(columnIndex){
case 0:
break;
case 1:
... |
b6354f69-d132-49e5-b620-e4bce7957cd2 | 9 | public void run() {
/* open Selector and ServerSocketChannel */
try {
Selector selector = Selector.open();
ServerSocketChannel serverSocketChannel = ServerSocketChannel
.open();
/* check if they were successfully opened */
if ((serverSocketChannel.isOpen()) && (selector.isOpen())) {
/* non-bloc... |
50b8d414-1e03-49c5-bd2f-9215e16614d4 | 5 | private HashSet<Tile> getVoid() {
HashSet<Tile> hsTile = new HashSet<Tile>();
for (Tile t : alTiles) {
for (int i = 0; i < t.getNeighboorsCount(); i++) {
if (t.getNumberOfRealNeighboors(i) >= 1) {
Tile n = t.getNeighboorBySide(i);
if (n.isFakeTile()
&& n.getNumberOfRealNeighboors((i + 3) % 6... |
efd6ba48-ac8d-411c-8ad9-1fd64405083a | 7 | protected AxisState drawLabel(String label,
Graphics2D g2,
Rectangle2D plotArea,
Rectangle2D dataArea,
RectangleEdge edge,
AxisState state) {
... |
166906bb-f0ce-4302-abd3-39d088d3afde | 9 | private void mp (LineNumber l1, LineNumber l2, Expression prove) throws IllegalLineException, IllegalInferenceException {
if ((l1.toString().length() > globalLine().toString().length()) ||
(l2.toString().length() > globalLine().toString().length())) {
throw new IllegalLineException("Incorrectly referencing li... |
0d69b3fb-daca-459a-aa62-c0412aa58dd4 | 5 | public static void takeTurn(Ant ant) {
ColonyNodeView currentNode = AntColony.node[ant.getLocationX()][ant.getLocationY()];
// If the bala is in a node with a colony ant, bala attacks ant. Otherwise, moves randomly.
if (currentNode == AntColony.node[13][13])
attackColonyAnt(ant);
else if (currentNode.scou... |
30467f81-bf8e-49d8-913b-9a05ae95cef2 | 3 | public void setLogLevel(final String name) {
Level level;
try { level = Level.parse(name); } catch (final Exception e) {
level = CustomPlugin.DEFAULT_LOG;
this.getLogger().warning("Log level defaulted to " + level.getName() + "; Unrecognized java.util.logging.Level: " + name + ";... |
81063c64-d9d2-4d08-9dbd-4aa17589ae5f | 6 | public void apply() {
// displayMapWalkable();
establishPatrolers();
// updatePatrollers();
establishAttackers();
claimMinerals();
patrol();
// astarTest();
switch (consumeState) {
case MORPH_DRONES:
morphToDrones();
break;
case SPAWN_POOLS:
buildSpawingPools();
break;
default:
b... |
165d1122-81cc-431b-84b0-d99b9d032519 | 9 | @Override
protected void handleMessage(Object o) throws Exception {
try {
// stopHeartBeat();
if( ! isOpen()) {
if(o instanceof Message) {
Message m = (Message) o;
m.setMessageSent(false);
} else if(o instanceof CloseConfirmationRequest) {
CloseConfirmationRequest req = (CloseConfirm... |
a2569ff4-3e63-4fba-a39f-86a7d586c48c | 1 | protected int getInt(final String key) {
if (getProperty(key) == null) throw new RuntimeException("int key not found in configuration: " + key);
return Integer.parseInt(getProperty(key));
} |
7c8e7f32-d915-47bb-8596-b9184eedd846 | 2 | public double standardizedAllResponsesTotal(){
if(!this.dataPreprocessed)this.preprocessData();
if(!this.variancesCalculated)this.meansAndVariances();
return this.standardizedAllResponsesTotal;
} |
f40de9be-d692-4bb9-b373-252c49b0f7bb | 2 | public int[] generate(int nplayers, int bowlsize) {
Random random = new Random();
int nfruits = nplayers * bowlsize;
int[] dist = new int[12];
int left1 = (int) Math.floor(0.75*nfruits);
int left2 = nfruits - left1 + 1;
for (int i = 0; i < 6; i++) {
int cnt ... |
cf810885-3439-4063-9bec-63f877c43c02 | 0 | public void calculateF() {
this.f = g + h;
} |
dd33d591-dfac-45bd-b6a1-665f92c05bc6 | 2 | public GUI getLastDialog() {
GUI lastDialog = null;
for (GUI gui: guiLayer){
if (gui instanceof GUIDialog)
lastDialog = gui;
}
return lastDialog;
} |
26391c3a-cc0e-4e86-aa53-96524a0d1b2c | 5 | @Override
public List<Ingredient> getAllIngredients() {
try (Connection connection = DriverManager.getConnection(connectionString)) {
List<Ingredient> categories = new ArrayList<Ingredient>();
Statement statement = connection.createStatement();
ResultSet rs = statement.executeQuery("select id, name, idParen... |
4ae722fa-3bbe-4d84-9c85-e021d6f0d0e6 | 3 | public synchronized void removeStock(String uid, Float increment, HashMap<String, Integer> stocks) throws IOException {
/* Code to remove the elements from the XML and rebuild the XML and increase the balance */
try {
Node userNode = getUserNode(uid);
NamedNodeMap attr = userNod... |
955a1214-3840-4dbc-8834-db145d0d3a09 | 9 | public int method304(int z, int x, int y, int uid) {
GroundTile groundTile = groundTiles[z][x][y];
if (groundTile == null) {
return -1;
}
if (groundTile.wallObject != null && groundTile.wallObject.uid == uid) {
return groundTile.wallObject.objectConfig & 0xff;
}
if (groundTile.wallDecoration != null &... |
d2b8d384-a711-4b1a-8143-f91a70757e59 | 5 | private StoreInstruction getExceptionStore(StructuredBlock catchBlock) {
if (!(catchBlock instanceof SequentialBlock)
|| !(catchBlock.getSubBlocks()[0] instanceof InstructionBlock))
return null;
Expression instr = ((InstructionBlock) catchBlock.getSubBlocks()[0])
.getInstruction();
if (!(instr instanc... |
23ef141b-e731-4f8d-b4b5-ab6361a3451a | 8 | public void handle_action(Attributes meta) throws SAXException {
String clazz = meta.getValue("class");
String id = meta.getValue("id");
String group = meta.getValue("group");
//todo: is it good to remove the action wich loaded twice, (2 of same action are working together)
System.err.pr... |
9dfff513-8efd-458c-8f2a-e5b505108372 | 9 | public static void main(String[] args) {
String path = "/Users/ahikmat/Documents/kh/handic"; //path to base folder
Workflow workflow = WorkflowFactory.getPredefinedWorkflow(path,WorkflowFactory.WORKFLOW_NOUN_EXTRACTOR);
try {
/* Activate the work flow in the thread mode */
workflow.activateWorkflow(true)... |
f73d76dc-ba30-4672-8f00-1266ee8bcc04 | 3 | public void mouseMoved(MouseEvent e) // used to show where the piece will be placed
{
for (Square[] a : squares)
{
for (Square s : a)
{
if (s.rect.contains(e.getPoint()))
{
x = s.x + 40;
y = s.y + 40;
}
}
}
} |
643850db-4f62-49fe-96e3-7e356078a560 | 2 | @Override
public void actionPerformed(ActionEvent e) {
OutlinerDocument doc = (OutlinerDocument) Outliner.documents.getMostRecentDocumentTouched();
OutlinerCellRendererImpl textArea = doc.panel.layout.getUIComponent(doc.tree.getEditingNode());
if (textArea == null) {
return;
}
Node node = textArea.n... |
e19f1f0b-58d9-4091-84d1-a24aee27fd38 | 7 | public void InitView() {
selectedRange = DataRange.THREEMONTH;
selectedChart = "line";
pane = new VBox();
lineChart = LinearChartManager.linear();
lineChart.setTitle("");
table = new TableView();
try {
table.getItems().addAll(NetworkManager.show(Data... |
c10cf04d-8d82-413a-b4b4-02722aa365c7 | 8 | public void grille(){
for(int y = 0; y<env.taille_envi;y++){
for(int x = 0; x<env.taille_envi;x++){
if(env.grille[x][y]!=null && env.grille[x][y] instanceof Explorateur){
Graphics g = agent[x][y].getGraphics();
g.setColor(Color.YELLOW);
g.fillOval(0, 0, agent[x][y].getHei... |
334923a7-5f94-4b89-a196-5d675939e1f8 | 5 | public static void Command(CommandSender sender, String[] args)
{
if(sender.hasPermission("gm.check.others"))
{
Player target = Bukkit.getPlayer(args[1]);
if(target != null)
{
if(sender instanceof Player)
me.Vinceguy1.ChangeGameMode.Functions.Message.Function(me.Vinceguy1.ChangeGameMode.ConfigCla... |
99e6d3d2-d989-4820-9101-5d09ad32e9a6 | 3 | private void setIndex(String name, Object value, String key) {
boolean isUnique = documentType.isUniqueIndex.get(name);
Object oldKey = indexMap.get(value);
if (oldKey == null) {
if (isUnique) {
indexMap.put(value,key);
} else {
ArrayList<S... |
326f116c-5dd0-4cbe-af1c-08acc5eb0e5b | 9 | private static void renderSkillOverview(int windowX, int windowY){
//Buttons
for(int i = 0; i < 3; i++){
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0.5f, 0.5f, 0.5f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2f(windowX + (i+1)*16 + i*(width-64)/3, windowY + 16);
GL11.glVertex2f(windowX + ... |
f0d4a5f0-83b4-469e-b410-5fa1139128d3 | 1 | private void LoadImdbData(MovieData data) throws Exception {
WebPage page = WebPage.loadWebPage(data.link_imdb, ENCODING);
Elements sidebarList = Jsoup.parse( page.getContent() ).getElementsByClass("star-box-giga-star");
if (sidebarList.isEmpty())
return;
Element sidebar =... |
77349146-9979-4513-8125-af0d516f9019 | 4 | public void actionPerformed(ActionEvent e)
{
String action = e.getActionCommand();
try {
if (action.equals(Constantes.BACK)) {
if (!history.isEmpty())
editor.setPage(history.removeFirst());
}
if ... |
8feecab5-6b97-408a-a867-d3aca1e5fe67 | 8 | @Override
public void synchronize(List jobIds, long timeout, boolean dispose)
throws DrmaaException {
Pointer<Pointer<Byte>> jobIdsPointer = pointerToCStrings((String[]) jobIds
.toArray());
Buffer eb = newErrorBuffer();
int result = drmaa_synchronize(
jobIdsPointer,
timeout,
dispose ? 1 : 0,
... |
8d31e018-0474-450f-997c-493be03408b3 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
a88142e3-785a-4d21-bb39-3d7eb87037b1 | 1 | public static void main(final String[] args) {
final Control c = new Control();
c.agregarEntidades(
new Object[][]{
{new Long(1), "Taladro", new Double(75000)}, // Agrega una Entidad Tornillo con Cantidad 1000 y precio 500
{new Long(2), "Taladro", ... |
c4fde149-51e1-48cf-8f58-45239e03a54d | 8 | @Override
public void applySGR(SGR... options)
{
for(SGR sgr: options)
{
if(sgr == SGR.RESET_ALL) {
currentlyBold = false;
currentlyBlinking = false;
currentlyUnderlined = false;
currentForegroundColor = new CharacterANS... |
74cc833a-6f1b-4ea4-b03e-da7e1469593d | 6 | private static void assertNum(int totalCounts,
List<List<Double>> dataPointsUnnormalized) throws Exception
{
int sum = 0;
for (int x = 0; x < dataPointsUnnormalized.size(); x++)
for (int y = 0; y < dataPointsUnnormalized.get(x).size(); y++)
sum += dataPointsUnnormalized.get(x).get(y);
if (totalCounts... |
7c22370b-12e0-46ef-bcc0-cd10a64762ec | 8 | protected Object getPrimitive(Element node) throws Exception {
Object result;
Object tmpResult;
Class cls;
cls = determineClass(node.getAttribute(ATT_CLASS));
tmpResult = Array.newInstance(cls, 1);
if (cls == Boolean.TYPE)
... |
5adba180-e817-42a6-9504-2a8f216faa3d | 0 | public ICalculator getCalculator(){
return new Calculator();
} |
739dadb2-7e91-464c-94bb-83c61b64907a | 8 | public Number toNumber(int size) {
switch(size) {
case 1:
if(data.length > 1) { throw new IllegalArgumentException("invalid byte array length - " + data.length); }
return (byte)toBigInteger().longValue();
case 2:
if(data.length > 2) { throw... |
aefe3f8d-2a18-4789-a3a6-6283396b31e4 | 2 | private void set(Object o, Object v) {
String _o = String.valueOf(o), _v = String.valueOf(v);
if (!_o.equals("msgid")) {
if (!_v.startsWith("{"))
_v = "\"" + _v + "\"";
}
_o = "\"" + _o + "\"";
sb.append(_o + ": " + _v + ", ");
} |
a76b47af-a1b2-4261-88ed-f65286fb441d | 7 | final private boolean jj_3_30() {
if (jj_scan_token(FOR)) return true;
if (jj_scan_token(LPAREN)) return true;
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_scan_token(COLON)) return true;
if (jj_3R_40()) return true;
if (jj_scan_token(RPAREN)) return true;
if (jj_3R_47()) return true;
... |
7bd597da-94b4-448f-8aea-7a45721b9c9d | 8 | private byte[] getClassBytes(String directoryResource) throws UnknownHostException, IOException, ClassNotFoundException {
Socket socket = new Socket(host, port);
PrintWriter output = new PrintWriter(socket.getOutputStream());
output.println("GET " + classRootDir + "/" + directoryResource + " HTT... |
5719a1ca-6efa-4628-9a47-8fa94294203f | 6 | public void getList(int rep, String searchText)
{
String tempQuery = "";
if(rep == 0) {
tempQuery = DEFUALT_QUERY;
}
else if(rep == 1) {
tempQuery = "select * from (Select memberid,lastname,firstname,midinit,nonmember.contactno1,nonmember.contactno2,nonmember.... |
7d4ec823-fcc9-48df-851e-eee2f5c3a9a2 | 6 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex < 0 || columnIndex >= COL_NAMES.length || rowIndex < 0
|| rowIndex >= propNames.length) {
return null;
}
if (columnIndex == 0) {
return propNames[rowIndex];
}
if (columnIndex == 1) {
return props.get(propNames... |
c790538f-f33d-4956-96d5-fcfea3554275 | 9 | private void writeAndPostProcessTextFile(final String path, final String mode, final LoggedDataInputStream dis,
int length, final WriteTextFilePreprocessor processor) throws IOException {
if (DEBUG) {
System.err.println("[writeTextFile] writing: " + path); // NOI18N
S... |
c67dafc3-152a-4f23-9ea1-e992373d4cb3 | 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 = ... |
92698466-0e2e-4d1c-a994-2cd63cede245 | 9 | public void readFields (Object object, Object jsonData) {
OrderedMap<String, Object> jsonMap = (OrderedMap)jsonData;
Class type = object.getClass();
ObjectMap<String, FieldMetadata> fields = typeToFields.get(type);
if (fields == null) fields = cacheFields(type);
for (Entry<String, Object> entry : jsonMap.entr... |
391159ea-4eb3-4ccd-a313-94fdd241517d | 1 | @SuppressWarnings("static-method")
public StdImage getIcon(Row row, Column column) {
return row == null ? column.getIcon() : row.getIcon(column);
} |
3a09a6cf-6e66-449b-b60d-6c52f1c37756 | 8 | public Collection read (Kryo kryo, Input input, Class<Collection> type) {
Collection collection = create(kryo, input, type);
kryo.reference(collection);
int length = input.readVarInt(true);
if (collection instanceof ArrayList) ((ArrayList)collection).ensureCapacity(length);
Class elementClass = this.elementCl... |
be07f344-af25-4aaa-af9c-5a0b252e52a0 | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
3c11f5ac-c618-4e02-a7c7-e491d8f45639 | 1 | public String getTaggedSentence ( String stringToTag ) {
String result = "";
List<List<HasWord>> sentences = tagger.tokenizeText(new StringReader(stringToTag));
for ( List<HasWord> sentence : sentences ) {
ArrayList<TaggedWord> tSentence = tagger.tagSentence(sentence);
re... |
a85ee360-3c9f-403a-a86d-07346f17bcb8 | 1 | public void joinMatch(String userName, String hostName){
try {
cs = con.prepareCall("{call joinMatch(?,?)}");
cs.setString(1, userName);
cs.setString(2, hostName);
cs.execute();
} catch (SQLException e) {
e.printStackTrace();
}
} |
16c47ded-c672-4ddb-bf85-d89a424176fe | 8 | private String formatTime(long millis){
String formattedTime;
String hourFormat = "";
int hours = (int)(millis/3600000);
if(hours >= 1){
millis -= hours*3600000;
if(hours < 10){
hourFormat = "0" + hours;
}
else{
hourFormat = "" + hours;
}
hourFormat += ":";
}
String minute... |
7fc2c6ff-2060-4252-b63c-13534d8a8343 | 1 | private void addPlayerLightTrailToElements() {
for (Player p : players) {
grid.addElement(p.getLightTrail());
}
} |
7e63712b-e764-457b-9958-3f273c387922 | 9 | private void postPlugin(final boolean isPing) throws IOException {
// The plugin's description file containg all of the plugin data such as name, version, author, etc
final PluginDescriptionFile description = plugin.getDescription();
// Construct the post data
final StringBuilder data =... |
a5893c88-874e-4979-8141-0252433aea90 | 5 | public int lastExonPositionBefore(int pos) {
int last = -1;
for (Exon ex : sorted()) {
if (pos < ex.getStart()) {
// Nothing found?
if (last < 0) {
System.err.println("WARNING: Cannot find last exonic position before " + pos + " for transcript '" + id + "'");
return -1;
}
return last;
... |
3aa51b90-67e3-402a-bf9c-ad23e27ebe00 | 4 | @Override
public WorkSheetHandle copyWorkSheet( String SourceSheetName, String NewSheetName ) throws WorkSheetNotFoundException
{
try
{
mybook.copyWorkSheet( SourceSheetName, NewSheetName );
}
catch( Exception e )
{
throw new WorkBookException( "Failed to copy WorkSheet: " + SourceSheetName + ": " + e... |
8c4dfac5-3205-45fe-8064-a1a03a0e61b5 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PrivateMessagePK that = (PrivateMessagePK) o;
if (recieverAccountId != that.recieverAccountId) return false;
if (senderAccountId != that.sender... |
7dea8a8b-793e-427a-9ff5-90edf69972c6 | 1 | public void input(String string) {
if (parser != null) {
parser.pause();
}
parseInput(string, null);
} |
63933b04-051f-45e4-b470-aea4eb50b2cd | 4 | private byte[] readBytesFromFile(File file) throws IOException {
InputStream is = new FileInputStream(file);
// Get the size of the file
long length = file.length();
// You cannot create an array using a long type.
// It needs to be an int type.
// Before converting to an int type, check... |
87dcc2b6-a3ab-4a03-918d-3ba629180444 | 9 | public final void setOpen(final boolean _open) {
//open or close the menu
if (_open != opened) {
if (menuListener != null) {
if (isOpen()) {
menuListener.beforeOpen();
} else {
menuListener.beforeClose();
}
} else {
Sta... |
fb47b238-a102-4859-a0fc-877836360f5b | 2 | public Theme loadTheme(String theme){
if(night) theme_return = theme_dark;
if(!night) theme_return = theme_light;
return theme_return;
} |
d5feb468-913a-48f2-8dee-a1bb076bc513 | 8 | @Override
public ActionResult action(Action action)
{
int i = (int) action.getProperty("i");
int j = (int) action.getProperty("j");
Unit unit = GameHandler.getUnit(i, j);
RangeType type = unit.type.attackRange;
int size = type.radius * 2 + 1;
boolean[][] allField = new boolean[size][size];
boolean... |
a1ce280e-ad82-4906-81f5-8c5a1a35b142 | 4 | public static void main(String[] args) {
try {
// Load the JSON data files
JSONObject
imgMap = new JSONObject(Program.readAsset("_map.json")),
bugList = new JSONObject(Program.readAsset("_bug.json"));
// Populate a list of Cards with data from the file
Card.Collection = new LinkedList<Card>();... |
3b86c4df-4068-4d8b-8c21-2e5ffc48e53e | 9 | void generateRandomDistributions(int nNodes, int nValues) {
// Reserve space for CPTs
int nMaxParentCardinality = 1;
for (int iAttribute = 0; iAttribute < nNodes; iAttribute++) {
if (m_ParentSets[iAttribute].getCardinalityOfParents() > nMaxParentCardinality) {
nMaxParentCardinal... |
0f90bb95-daf5-4915-afaa-dea4b614307d | 0 | public int getPlayerScore() {
return player.getScore();
} |
ee33567f-cabc-446b-bdc4-5bd067b862be | 5 | public int getDigitToTypeIndex() {
Widget clickText = widgets.get(PARENT_ID, 151);
if (clickText != null) {
if (clickText.getText().equals("First click the FIRST digit."))
return 0;
else if (clickText.getText().equals("Now click the SECOND digit."))
retu... |
c45c0743-c546-46c2-b0f9-4042d90710e8 | 8 | public void updateGround() {
if(!prot.isAirborne()) {
if(!PhysicsUtil.touchesAbove(prot.getGround(), prot)) {
prot.detach();
prot.setAirborne(true);
for(Block block:blocks.getBlocksAt(prot.getCenterX()-prot.getRectangleWidth()/2)) {
... |
12ca79c0-0123-4993-a494-1cc7841db7b8 | 6 | public static final void Others(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) {
final int type = slea.readByte();
final byte numRecipients = slea.readByte();
int recipients[] = new int[numRecipients];
for (byte i = 0; i < numRecipients; i++) {
recipients[i] = slea.rea... |
5a0eea1b-42e7-45ac-b106-61f5e02d2b5a | 6 | private boolean isCycleHelper(int u, int v, int n, int w){
if(n == 1){
int[] adjacent = new int[10];
adjacent = adjacent(u,w);
//System.out.println(Arrays.toString(adjacent));
for(int i = 0; i < adjacent.length; ++i){
if(v == adjacent[i])
... |
e1d73de4-c31e-402c-b67f-82b9bb549d6e | 3 | @Override
public void saveConfig( ArrayList< ? extends ConfigInterface > config,
String configPath )
{
File output = null;
FileOutputStream fos = null;
OutputStreamWriter osw = null;
BufferedWriter writer = null;
try
{
output = new File(configPath);
fos = new FileOutputStream(output);
osw = n... |
9affd506-883e-475e-aba6-391ae18f830e | 0 | public Map<Integer, LayoutControl> getUserControls() {
return this.userControls;
} |
8bf5f21c-e1d5-4f55-a1dd-2130afdcb95e | 5 | private void OLDdoFinish(
String containerName,
String fileName,
IProgressMonitor monitor)
throws CoreException {
// create a sample file
monitor.beginTask("Creating " + fileName, 2);
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IResourc... |
1cc04942-03e9-43b1-bd37-f3990422de42 | 5 | protected java.lang.Class<?> loadClass (String name, boolean resolve) throws ClassNotFoundException {
// These classes come from the classloader that loaded AccessClassLoader.
if (name.equals(FieldAccess.class.getName())) return FieldAccess.class;
if (name.equals(MethodAccess.class.getName())) return MethodAccess... |
4df593d7-cc30-4999-ae4a-ba107c4590c3 | 4 | public synchronized void receive(File file, boolean resume) {
if (!_received) {
_received = true;
_file = file;
if (_type.equals("SEND") && resume) {
_progress = file.length();
if (_progress == 0) {
doReceive(file, false);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.