method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
2e28f840-0b9f-4835-a3b3-f738434aecfa | 4 | private DistanceResult findNearestCluster(double[] position)
throws ClusterException {
DistanceResult res= new DistanceResult();
for(int i= 0; i< this.clusterNumber; ++i) {
double[] centroid= this.clusterList.get(i).getCentroid();
double similarity= this.cosineSimilarity(position, centroid);
if(r... |
a14b9d65-110f-4ab5-92aa-5bdf1c2c5428 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
484b330a-fc30-44b5-b409-c55b3f1607fc | 2 | public static MobilityFacilityEnumeration fromValue(String v) {
for (MobilityFacilityEnumeration c: MobilityFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
268717bb-1afa-417c-aa12-d2f4cd4258da | 8 | void write(byte[] bytes, int offset, int len){
if(stage == READ_BODY){
body.write(bytes, offset, len);
return;
}
buffer.append(new String(bytes, offset, len));
if(buffer.indexOf(NL) == 0){
stage++;
body.write(bytes, 2, len);
... |
f4c50e70-4cd5-4971-8c0e-ed696cc50792 | 2 | public boolean check(String str)
{
str = Normalizer.normalize(str, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "").toUpperCase();
for (String keyword : keywords)
{
if (!str.contains(keyword))
return false;
}
return true;
} |
2c93d2c3-a475-48ec-89fc-3b3eadbddbc2 | 8 | public HashSet<Cell> jointCell(Cell aimCell) {
HashSet<Cell> tempCells;
tempCells = new HashSet<>();
for (Cell tempCell : cells) {
if (tempCell.openValues.size() == 1) continue;
if (aimCell.x == tempCell.x) {
tempCells.add(tempCell);
}
... |
4c536615-9ba5-4da4-93e7-069b9595d653 | 8 | private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
// Cancel
boolean resThrown=false;
for(Reservation r:reservations){
if(r.getMember().getFirstName().trim().equals(jTextField32.getText().trim().sp... |
2f0b5b8b-385e-46f8-a3b1-94882545fe26 | 4 | public void insertBST(Node node, int value)
{
if (value < node.value)
{
if (node.left != null)
{
insertBST(node.left, value);
}
else
{
System.out.println(" Inserted " + value + " to left of node " + node.value);
node.left = new Node(value);
}
}
e... |
348f870d-64a9-4f69-b85d-b5adf29e9c8d | 5 | private static double readValueFromURL(String url) throws IOException {
URL oracle = new URL(url);
BufferedReader in = new BufferedReader(
new InputStreamReader(oracle.openStream()));
String inputLine;
String filetext="";
while ((inputLine = in.readLine()) != nul... |
c68e0148-8e87-46da-9f69-ea5d4e245ae1 | 0 | public FrozenBodyArmor() {
this.name = Constants.FROZEN_BODY_ARMOR;
this.defenseScore = 10;
this.money = 300;
} |
ddad2022-bfec-4086-8d77-e3828a7f27f0 | 1 | public synchronized static Stock queryStock(String identifier) {
StockStorage store = StockStorage.getInstance();
Stock s = store.query(identifier);
if (s == null) {
s = StockQuery.QueryOne(identifier);
store.addStock(s);
store.save();
}
s = st... |
626a4bca-d222-4b2a-be5f-62af3468491b | 0 | public List<TableColumnDesc> getTable() {
return table;
} |
7d321f55-acf8-4617-a475-59b1edbd989b | 7 | public static Map<String, String> readKeyValueConfigFile(String filePath) {
if (TextUtils.isEmpty(filePath)) {
Log.e(TAG + ":" + "config path is null");
return null;
}
Map<String, String> pair = null;
RandomAccessFile c = null;
try {
c = new RandomAccessFile(new File(filePath), "r");
String line =... |
b3d50fe3-200d-41cb-af91-2da28909ade9 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof MalhaLogistica)) {
return false;
}
MalhaLogistica other = (MalhaLogistica) obj;
if (pontoDestino == null) {
if (other.pontoDestino != null) {
return fa... |
215fc1dd-b2df-497b-927b-f785fba86cb5 | 1 | public Image getImage() {
if (!imageLoaded) {
loadImage();
}
return image;
} |
0d424fc1-387e-4ae3-925b-50e6efba8dcb | 8 | private static void saveMenuItem(String string, int id, int i, int j) throws Exception {
Connection conn;
Statement stmt = null;
ResultSet rs = null;
int rc=-1;
String cost="NORMAL";
switch(i) {
case 0:
cost="NOCHARGE";
break;
... |
4f0f03f0-d3b8-4f64-b383-0ce7246b9fa0 | 5 | protected void updateTransition(Transition t, float delta) {
switch (t.type) {
case (Transition.TYPE_FADEIN): {
alpha = MathUtils.clamp(t.runningTime/t.duration, 0, 1);
break;
}
case (Transition.TYPE_FADEOUT): {
alpha = MathUtils.clamp(1-(t.runningTime/t.duration), 0, 1);
break;
}
... |
faf18f37-b054-48b2-a3a9-2db4325a01de | 0 | public MyCustomEventApplicationListenerAdapter(MyCustomEventListener listener) {
this.listener = listener;
} |
d65744a7-44a9-4ab0-bd1a-861fd4979d44 | 0 | @Override
public String toString(){
return super.toString()+ " in category : Head Armor" + " with Defence " + this.defenseScore;
} |
8fb4e794-5be8-415d-b957-df0934e94118 | 0 | public static void main(String[] args) {
int rows = 20, cols = 3;
Pentominos f = new Pentominos("Pentominos",rows, cols);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);
} |
6e55bded-4918-4665-bd9e-f69429f782dc | 6 | public void queueBytes(int i, byte abyte0[])
throws IOException
{
if(closed)
return;
if(hasIOError)
{
hasIOError = false;
throw new IOException("Error in writer thread");
}
if(buffer == null)
buffer = new byte[5000];
synchronized(this)
{
for(int l = 0; l < i; l++)
{
buffer[buffInd... |
3def4fed-a770-4658-b1da-8ce290aefdff | 1 | public void remove(Vehicle d) {
if (d != null) {
_cars.remove(d);
//System.out.println("Removed " + d + " from " + this);
}
} |
5725fb2d-f91c-4bc4-bf2e-b257d85d319e | 0 | public void mouseClicked(MouseEvent event) {
} |
a89498d4-d327-40f0-b8e3-26647d60802c | 1 | public Speicherzelle getPCL(boolean bank1) {
if(bank1)
return speicherZellen[0x02];
else
return speicherZellen[0x82];
} |
b0d8949c-01b6-481e-8767-c3b8ea3ad3a1 | 6 | private boolean checkIfCanConnect(ClassSubInstance instance) {
ModelInstance meta_model = ModelInstance.getInstance();
if(state == ConnectorState.FIRST_CLICK) {
for(AssociationInstance assoc : meta_model.instanced_assocs.values()) {
if(assoc.source_id == instance.meta.id)
return true;
}
}
else {
... |
07297390-f81f-44bd-951a-810d94d3a087 | 2 | private String wrap(String text, int lenght){
String[] words = text.split("\\s");
StringBuilder ans = new StringBuilder();
int curLenght = 0;
for(String word : words){
curLenght += word.length();
if(curLenght <= lenght){
ans.append(" ");
... |
a3901120-0b41-4944-a23d-fa54ea6e5e00 | 8 | public int accion( boolean PF, boolean PD, boolean PA, boolean PI, boolean MT ){
int dir = (int)(4*Math.random());
while( (dir==0 && PF) || (dir==1 && PD) || (dir==2 && PA) || (dir==3 && PI) ){
dir = (int)(4*Math.random());
};
return dir;
} |
9e731084-45f6-4594-8972-07a7cbb48f33 | 7 | Composite(VirtualMachineImpl vm, PacketStream ps)
{
if(vm.traceReceives)
{
vm.printTrace("Receiving Command(id=" + ps.pkt.id + ") JDWP.Event.Composite" + (ps.pkt.flags != 0 ? ", " +
"FLAGS=" + ps.pkt.flags : "") + (ps.pkt.errorCode != 0 ? ", ERROR CODE=" + ps.pkt.errorCode : ""));
}
suspe... |
32be7526-8f9a-4619-9e6d-37926cf41b6d | 9 | public void appendEnvironmentReport(Node container, Document factory, Hashtable h)
{
if ((null == container) || (null == factory))
{
return;
}
try
{
Element envCheckNode = factory.createElement("EnvironmentCheck");
envCheckNode.setAttribute("version", "$Revision: 468646 $");
... |
e0bd1ab3-7021-4486-9886-715a030403c4 | 4 | private void save() {
if (song == null) return;
if (title.getText() != song.getName())
song.setName(title.getText());
if (artist.getText() != song.getArtist())
song.setArtist(artist.getText());
if (album.getText() != song.getAlbum())
song.setAlbum(album.getText());
listener.savePressed(song);
... |
98584f1d-1214-40bc-b0f4-892688c3b5f9 | 2 | public void addEdge(T v, T w) throws InvalidEdgeException,
SelfLoopExistsException, ParallelEdgeExistsException
{
// / Insert names into the hash table. Associate current size as the
// value
if (!contains(v))
st.put(v, st.size());
if (!contains(w))
st.put(w, st.size());
// Reverse index
keys.set... |
66793a86-ffe9-4135-a770-acda322c74d8 | 2 | @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
super.startElement(uri, localName, qName, attrs);
if (qName.equals("rowset")) {
list = new StandingsList();
list.setName(getString(attrs, "name"));
} else if (qName.equals("row")) {
Api... |
fe9cdfc9-80f7-489f-880c-2f4ea4b01655 | 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... |
58730ca2-4057-448f-988e-0f8e6d76bd80 | 0 | @Override
public String toString() {
return "[Locale object: id=" + this.id + " name="+ this.name + " desc=" + this.desc + "item=" + this.item + "]";
} |
e1c6ad98-6ac7-427f-ab67-86cad5e700da | 8 | void setUp() {
//<editor-fold defaultstate="collapsed" desc="JFrame setup">
setFont(new Font("Bitstream Vera Sans Mono", 0, 20));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(800, 600);
setLocationRelativeTo(null);
currentGame = new Game(this);
//</edit... |
db638109-9706-4103-9c84-2680f332cb61 | 6 | public void masterUpdate(){
this.add(this.actualState);
AbstractState stateAtStart;
while(true){
stateAtStart = this.actualState;
/* WE CHECK IF THE STATE AS CHANGE */
for(AbstractState s : this.states){
if(s.getActive())
if(s != this.actualState){
this.actualState = s;
}
}... |
3927be37-0fed-4f11-8ee8-6e5bf90107df | 8 | public int compareTo(Object tmp )
{
int result;
if (tmp instanceof Person)
result = (firstTicks < ((Person)tmp).GetFirstTicks() ? -1 : (firstTicks == ((Person)tmp).GetFirstTicks() ? 0 : 1));
else if (tmp instanceof BlankEvent)
result = (firstTicks < ((BlankEv... |
b4396deb-5418-4dda-b3b4-0e809b27a8f0 | 2 | public void connect() throws IOException
{
try
{
sslsocket = (SSLSocket)SSLSocketFactory.getDefault().createSocket(server, port);
in = new BufferedInputStream(sslsocket.getInputStream());
out = new DataOutputStream(sslsocket.getOutputStream());
doHandshake();
}
catch (IOException e)
{
// If w... |
c59748ea-cc8a-40bf-be76-9f4f73b464e2 | 0 | @Override
public synchronized void handlePieceSent(SharingPeer peer, Piece piece) {
logger.trace("Completed upload of " + piece + " to " + peer);
this.uploaded += piece.size();
} |
896991f6-b070-4078-aa8a-d02009116b2f | 8 | public int solution(int[] A) {
int candidateIndex = findCandidateIndex(A);
if (candidateIndex == -1) return 0;
int candidate = A[candidateIndex];
int candidateCount = 0;
for (int i = 0; i < A.length; i++) {
if (A[i] == candidate) candidateCount++;
}
... |
d76f1fc2-f940-4ef4-ba1d-f2539da716ea | 6 | public UNote[] getNotes()
{
UNote[] tempnotes = new UNote[MAX_NOTE_SAME_TIME];
int index = 0;
for(int i=0; i<activeSequence; ++i)
{
USequence s = sequences[i];
if(!s.mute)
{
UNote n = s.getNote(currentTik, restTik);
if(n != null)... |
9c96bedf-0059-4f1c-ac30-62fe31c9dc23 | 0 | public BSTNode getLeft() {
return left;
} |
52cf7d76-3ed3-4a46-96ed-0e8cc0f52b27 | 8 | public GenLayerRiverMix stackedContinents(ClimateControlSettings settings, long worldSeed)
{
GenLayer emptyOcean = new GenLayerConstant(0);
GenLayer genlayerisland = new GenLayerOceanicIslands(1L, emptyOcean, settings.largeContinentFrequency.value());
GenLayerFuzzyZoom genlayerfuzzyzoom = ne... |
9134aad6-78e5-480d-833e-b372e1b108d3 | 6 | static void sieve(int max) {
long[][] s = new long[max + 1][2];
boolean[] v = new boolean[max + 1];
int[] depth = new int[max + 1];
for (int i = 0; i <= max; i++)
s[i][0] = s[i][1] = 1;
for (int i = 2; i <= max; i++)
if (!v[i]) {
s[i][0] = s[i][1] = 1;
for (int j = i; j <= max; j += i) {
s[... |
53195d91-d8da-44a2-b268-626f7e5f02f4 | 4 | @Override
public void printMap() {
for(int y=0;y<mapSteps[0].length;y++) {
for(int x=0;x<mapSteps.length;x++)
System.out.print("#.~ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(collisionMap[x][y]?0:(mapSteps[x][y]==grassTile?2:1)));
System.out.println();
}
System.out.println();
} |
1639965f-3f1a-4ece-ab6b-3477a8a98a80 | 6 | @Override
public int getIndex(TreeNode arg0) {
if (arg0 instanceof Section) {
Section soo = (Section) arg0;
for (int i = 0; i < this.sectionCount(); i++) {
if (this.getSection(i).equals(soo))
return i;
}
return -1;
} else if (arg0 instanceof ... |
34fd8d96-76ea-4c97-b4b8-db0f54f19542 | 8 | public void build () throws ExceptionInvalidParam
{
if ( eastLonBound <= westLonBound
|| northLatBound <= southLatBound
|| destWidth <= 0
|| destHeight <= 0
|| sourceModule == null
|| destNoiseMap == null)
throw new ExceptionInvalidParam ("I... |
f76b5e4d-b821-4268-a7fe-c260ab591ab3 | 2 | public MediaAdapter(String audioType) {
// Java 8 can use Strings in switch
switch (audioType) {
case "VLC":
advancedMediaPlayer = new VLCPlayer();
break;
case "Mp4":
advancedMediaPlayer = new Mp4Player();
break;
default:
break;
}
} |
a7051265-a3b4-44d7-991e-f4b0ff7711d2 | 3 | public String changeMatchValue(Character c) {
if (Pattern.matches(this.getMatchSring(), c + "")) {
this.setMatchValue(this.getMatchSring());
}
if (Pattern.matches(this.getMatchNum(), c + "")) {
this.setMatchValue(this.getMatchNum());
}
if (Pattern.matches(... |
3be16ae3-022c-4d22-b1c2-51f5fd54071b | 3 | public void retirarProduto(int codigo, int quantidade)
throws ProdutoException {
try {
Produto produto = buscarProduto(codigo);
if (quantidade < 0)
throw new ProdutoException("Quantidade menor que 1!");
else if (quantidade <= produto.getQuantidade())
produto.setQuantidade(produto.getQuantidade() -... |
188c3953-abc3-4d82-b056-ea8919df2d75 | 9 | private int tupleSize ()
{
int s = 0;
for (int j = 0; j < domain.length; j++) {
switch (domain [j].getName ()) {
case "java.lang.Byte": s += 1; break;
case "java.lang.Short": s += 2; break;
case "java.lang.Integer": s += 4; break;
... |
288e9f1f-1e0d-40ce-923a-88e6a632386b | 9 | public static void main(String[] args) {
// N-by-N percolation system (read from command-line, default = 10)
int N = 5;
if (args.length == 1)
N = Integer.parseInt(args[0]);
// turn on animation mode
StdDraw.show(0);
// repeatedly open site specified my mouse click and draw resulting
// system
Syste... |
35264ce0-efb3-415a-915d-3b39bf357461 | 6 | public boolean find(int arr[], int givenSum) {
int len = arr.length;
for (int i = 0, j = len - 1; i <= j;) {
if (arr[i] + arr[j] == givenSum) {
System.out.println("Given no : " + givenSum
+ " found at index : " + i + " value :" + arr[i]
+ " and index : " + j + " value : " + arr[j]);
return t... |
a7f450ba-a72c-44a1-ab96-c5dc337b2873 | 3 | String consumeDigitSequence() {
int start = pos;
while (pos < length) {
char c = input[pos];
if (c >= '0' && c <= '9')
pos++;
else
break;
}
return new String(input, start, pos - start);
} |
b59a9858-184d-43d1-b7d0-6af592f19a50 | 2 | public FloatBuffer toFloatBuffer()
{
FloatBuffer buffer = BufferUtils.createFloatBuffer( 16 );
for ( int i = 0; i < 4; i++ )
for ( int j = 0; j < 4; j++ )
buffer.put( m[i][j] );
buffer.flip();
return ( buffer );
} |
73266c90-ffd3-458c-ab5a-1275738fb29e | 1 | public Entity render()
{
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (texture != null)
{
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(position.x, position.y);
GL11.glTexCoord2f(1, 0);
G... |
4e6172ae-a05e-4f8a-8e53-a7b3030acc0d | 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... |
58aa7a11-a5c0-47b5-ac30-b2d57ac8148b | 8 | @Override
public synchronized void undo() throws CannotUndoException {
if (!canUndo())
return;
AbstractDocument.DefaultDocumentEvent lastUndo = null;
AbstractDocument.DefaultDocumentEvent nextUndo = null;
UndoableEdit ue;
while((ue = super.editToBeUndone()) != null) {
if (!canUndo()) {
break;
}
... |
ec544b07-ea38-49e5-af22-a6e7a2d7f9e5 | 2 | @Override
public void render(Screen screen) {
screen.renderBlank(getX(), getY(), 96, 96, 0xff000000);
if (tetromino != null) {
if (enabled) {
tetromino.renderStatic(screen, GameFrame.BLOCK_SCALE + getX(), GameFrame.BLOCK_SCALE + getY());
} else {
tetrom... |
0f3612e3-7912-448c-ab4d-f7549b3d208a | 0 | public String getDireccion() {
return direccion;
} |
a25194ad-c2e4-48d8-a524-00636b9bda2b | 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... |
6067210b-52fd-43fd-b269-f12267a037c0 | 0 | @Override
public String toString()
{
return String.format( "not(%s)", this.delegate );
} |
59132f5e-7703-4a8f-b4ed-96afe66193e3 | 0 | public void setNode(Node node) {
this.node = node;
} |
dd1eb8e6-775c-4cbb-afa0-dcd46acf4194 | 5 | static public String generalizeVersion(String v) {
if (v==null)
return "*";
String[] vs=v.split(".");
int ix=v.length()-1;
if(ix<=1)
return "*";
while(ix>0 && vs[ix].equals("*"))
ix--; // skip any * fields starting from the end
String n... |
f494a63e-a0ad-4d5f-b26d-cc67cee0a01a | 4 | private void refreshButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshButtonActionPerformed
String folderSelectedText = null;
if(folderList.getCurrentItem() != null){
folderSelectedText = folderList.getCurrentItem().getText();
}
String a... |
edbc1faf-a18a-4c58-b709-a9d19794b4e0 | 3 | @Override
public ExecutionContext run(ExecutionContext context) throws InterpretationException {
Value value = ((AbsValueNode) this.getChildAt(0)).evaluate(context);
if (value.getType() == VariableType.STRING) {
String str = (String) value.getValue();
if(str.equalsIgnoreCase... |
a99df939-6e43-4c7a-872d-2c729e82619a | 9 | private Set<Player> play() {
running = true;
initIOControllers();
for (int round = 0; running && (round < gameState.getTableSize()); ++round) {
for (Player player : playerOrder) {
playerMove(player);
if (!running) break;
}
}
... |
a6d67c76-d493-4cb9-addc-dc65d2c53f02 | 3 | @Test
public void testRunStartServerSpotHandicapped()throws Exception{
AccessControlServer server = new AccessControlServer(1933);
server.start();
SpotStub spot = new SpotStub("120",1933);
spot.start();
sleep(1000);
String ans = "";
int x = 0... |
52e71764-af03-4b28-aa41-a48f4b68295b | 1 | public final void initUI() {
panel = new JPanel();
panel.setLayout(new BorderLayout());
ImageIcon open = new ImageIcon("./files/img/open.png");
JToolBar toolbar = new JToolBar();
JButton openb = new JButton(open);
openb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e... |
172086e9-d31a-4bb5-89c5-b977d346be81 | 6 | public void show() {
System.out.println(objResult.ResultName+"\t"+objResult.ResultList.size());
for ( String ResultName:objResult.Result_Count.keySet() ) {
System.out.println("ResultName = " + ResultName +"\t" + objResult.Result_Count.get(ResultName));
}
for ( int i = 0; i < objResult.ResultList.size(); i ++... |
215b1ab3-ab20-42da-8bd0-ecf5ffac4e1e | 2 | public static Muster findMusterById(ArrayList<Muster> musters, int id) {
for(Muster muster:musters) {
if(muster.getId()==id) {
return muster;
}
}
return new Muster();
} |
0c414ad9-2a64-47b7-b59d-4b1763e99b99 | 2 | public double[][] getWaveFunction(double energy) {
// FIXME magic number
long X_POINTS_DENSITY = 40 * 1000_000_000L; // 40 dots per 1 nm
// Number of dots in the whole MatterStack
int numberOfDots = (int) (getWidth() * X_POINTS_DENSITY);
// TODO try-catch or think on long-or-i... |
64faf886-a4cc-49ec-994a-ef18363b3198 | 3 | private boolean compareTimeStamp(int ts1, int rk1, int ts2, int rk2) {
if (ts1 > ts2) {
return true;
} else if (ts1 == ts2) {
if (rk1 > rk2) {
return true;
}
}
return false;
} |
ef346f53-c049-4636-88dd-7ef9a7fd4dc6 | 0 | public String getType() {
return "lsystem";
} |
fda95f4b-b589-4da1-aa30-9921fbaaf9de | 6 | public ChildContainerResult filter(ChildContainerResult unfiltered) throws ServerErrorException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
freenet.client.filter.ContentFilter.FilterStatus status =
freenet.client.filter.ContentFilter.filter(new ByteArra... |
21d22725-f536-4664-8f61-e4b8eb0a9352 | 3 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource() == this.executeBtn) {
Cursor normal = this.getCursor();
final JDialog d = new JDialog();
JPanel p1 = new JPanel(new GridBagLayout());
p1.add(new JLabel("Please Wait..."), new GridBagConstraints());
d.getContentPane().add... |
386b51f1-2319-4797-9874-923e2b4f4666 | 8 | public boolean isRoadValid(MapEdge edge) {
int graphState = PathFinder.getState();
int type = edge.getType();
String oneway = edge.getOneWay();
if (graphState == 0) { /* car graph */
if (oneway.equalsIgnoreCase("n") || edge.getMaxSpeed() == 0 || type == 8 || type == 48) {
... |
c5cc5cba-358d-4c4e-8ece-aaf0a3cbbca8 | 8 | protected Address getCoordinator(Message msg, GMS.GmsHeader hdr) {
switch(hdr.getType()) {
case GMS.GmsHeader.JOIN_RSP:
try {
JoinRsp join_rsp=Util.streamableFromBuffer(JoinRsp.class, msg.getRawBuffer(), msg.getOffset(), msg.getLength());
View ... |
e2a729d8-46bd-4780-b5f7-d51ad3ffbf06 | 1 | public static BufferedImage loadImage(String name)
{
try
{
return ImageIO.read(Imageloader.class.getClassLoader().getResourceAsStream("gfx/" + name +".png"));
} catch(IOException e)
{
e.printStackTrace();
}
return null;
} |
d9b454ef-febc-4d88-b122-2f9d07c772c5 | 1 | public void drawCollectionMenu() {
// Temporary storage
int initialY = screenHeight - 80;
int tempX = 0, tempY = 0;
// Add code for collection menu
for (int i = 0; i < parent.getCollectionLength(); i++) {
// Temp storage for position, passed to collection class for
// mouseOver detection
tempX = s... |
19e823e4-992d-47d8-b3a7-f641d734945c | 7 | public void actionPerformed(ActionEvent e)
{
if (e.getSource() == entryField)
{
processCommand();
}
else if (e.getSource() == buttonLook)
{
GameEngine.interpretCommand("look");
}
else if (e.getSource() == buttonNorth)
{
... |
a43b46dc-fe1e-43ae-8380-f31142144ec0 | 6 | public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("dans upload");
String UPLOAD_DIRECTORY = "pictures";
out.println(UPLOAD_DIRECTORY + "\n");
// if (!Servl... |
618dd441-ccf8-47b8-8755-66f00d614580 | 7 | private void move() {
xa = 0;
ya = 0;
List<Player> players = level.getPlayers(this, 100);
// System.out.println("players.size() = " + players.size() + " - Chaser.java" );
if (players.size() > 0) {
Player player = players.get(0);
if (x < player.getX()) xa+=speed; // if Chaser's x coordinate i... |
5ff5155e-bd8a-46f5-bbc9-99db7c372d9c | 6 | public static void main(String[] args) {
//Define loops to loop through each possible way the coins can add up
for (int quarters = 0; quarters <= 5; quarters++) {
for (int dimes = 0; dimes <= 12; dimes++) {
for (int nickles = 0; nickles <= 25; nickles++) {
for (int pennies = 0; pennies <= 106; pennies++... |
a8d6a9e0-a214-4773-80b6-9d11fc4e3ad5 | 3 | @Override
public void deserialize(Buffer buf) {
dungeonId = buf.readInt();
if (dungeonId < 0)
throw new RuntimeException("Forbidden value on dungeonId = " + dungeonId + ", it doesn't respect the following condition : dungeonId < 0");
xpBonus = buf.readInt();
if (xpBonus <... |
31901406-cf5a-4b38-9609-a674563601d1 | 7 | public String oddOccur(String[] words) {
if (words.length == 0) {
return null;
}
if (words.length == 1) {
return words[0];
}
Hashtable<String, Integer> hash = new Hashtable<String, Integer>();
ArrayList<Integer> nums = new ArrayList<Integer>();
int serial = 0;
int target = 0;
for (int i = 0; i <... |
e39fe00a-5d42-4d52-8f38-71774a037cd2 | 8 | public void read() {
if (!_file.exists()) {
return;
}
_users.clear();
try {
FileInputStream fileInputStream = new FileInputStream(_file);
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
try {
Object obj;
while ((obj = objectInputStream.readObject()) != null) {
... |
cfdb13cf-63b6-48bd-b287-00ea5c513ace | 4 | public void display() {
try {
String serviceType;
String desc;
String input;
String roomNumber;
Scanner sc = new Scanner(System.in);
do {
System.out.println("SHS SERVICE REQUST SERVICE: ENTER y/Y to procees or q/Q to quit")... |
01b53a41-4985-4089-a741-c7e52d52007b | 2 | protected boolean inRange(Point posObjectivo, int rango){
int xDif = Math.abs(posicion.x - posObjectivo.x);
int yDif = Math.abs(posicion.y - posObjectivo.y);
return xDif <= rango && yDif <= rango && Math.abs(yDif - xDif) <= rango;
} |
8b503368-6ab9-46a2-b692-1f89da9996f2 | 6 | public static String decode(final String origin, final String key, int limit) {
boolean unlimited = true;
if (limit > 0) {
unlimited = false;
}
final StringBuilder resultBuf = new StringBuilder();
final LinkedList<Character> src = (LinkedList) preprocess(origin);
... |
14e9aa0c-f2db-42e9-ae0b-e3f9905a4f5c | 2 | private int[] fillCircleBits() {
int d = getD();
int[] circleBits = new int[d*d];
prepareBits(circleBits);
int x = -r;
int y = 0;
int F = 1 - r;
int delta_Fs = 3;
int delta_Fd = 5 - 2*r;
while( x + y < 0){
plot8(circleBits, x, y, r);... |
fb927d01-1948-4d29-9e51-6d318612a0e1 | 9 | private boolean verifyPage(Buffer buffer, long page, int level, Key key, Tree tree) {
if (buffer.getPageAddress() != page) {
addFault("Buffer contains wrong page " + buffer.getPageAddress(), page, level, 0);
return false;
}
if (buffer.isDataPage() || buffer.isIndexPage()... |
3bc39718-7444-4ee3-bc6e-8482b1859c93 | 8 | @Override
public boolean inverse(SliceIntArray src, SliceIntArray dst)
{
if ((!SliceIntArray.isValid(src)) || (!SliceIntArray.isValid(dst)))
return false;
final int count = this.dim * this.dim;
if (src.length != count)
return false;
if (dst.array.length < count)
... |
5ded511a-c363-4200-a5e4-1ba6c6b5e7f5 | 8 | public void update(Observable o, Object arg) {
if (o instanceof MouseAdapter) {
currentSlot.setCurrent((String) arg);
if (!currentSlot.getCurrent().equals(currentSlot.getPrevious())) {
labelList.get(getIndex(currentSlot.getPrevious())).setBackground(Color.WHITE);
}
} else if (o ins... |
98bbe527-d47e-4375-8038-d9186e839816 | 9 | @Override
public SetOfSentences doProcess(SetOfSentences sos) {
ArrayList<Eojeol[]> eojeolSetArray = sos.getEojeolSetArray();
ArrayList<Eojeol[]> resultSetArray = new ArrayList<Eojeol[]>();
int len = eojeolSetArray.size();
String prevTag = null;
boolean changed = false;
for (int pos = 0; pos < len; p... |
4ffad6f9-d354-4aa4-91fc-74264d88b88e | 0 | private Object afterCall(Object result) throws Exception {
IRemoteCallObject rco = (IRemoteCallObject)result;
return rco.getDataObject().getData();
} |
4aec635e-d84d-48e0-90e8-4aeac1779809 | 3 | public void launch(){
int[] a = {10, 20, 30, 40, 50};
int[] b = new int[5];
int[] c = new int[3];
int[] d = new int[7];
ArrayCopier copier = new ArrayCopier();
copier.copy(a, b);
copier.copy(a, c);
copier.copy(a, d);
for(... |
0159ed32-6649-4bb3-b8dd-5cf298c2db38 | 7 | private void cross(LinkedList<Individual> childs, int[] genotypeBits,
List<DoubleValue> parents)
{
DoubleChromosome[][] childs_dna = new DoubleChromosome[numOfParents][genotypeBits.length];
//numOfParents = numOfChids = numOfCuts+1
for(int chr=0; chr<genotypeBits.length; chr++){//for each chromosome
... |
9394acb9-5b5b-4137-8dbf-b56547030540 | 0 | public static void main(String[] args) {
MHTree tree=new MHTree();
int[][]arr={{1,0},{1,2},{1,3}};
int n=4;
List list=tree.findMinHeightTrees(n,arr);
System.out.println(list);
} |
5f5a10b0-b84b-49e6-be49-2fb8f101c0df | 0 | public void done() {
jLabel3.setText("傳送完成!");
jButton1.setEnabled(true);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.