method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
95efa1c1-ea2a-484e-9d92-a02d3434d58b | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
d5235ed3-c268-4f6d-aac4-5f4f0e3d3b34 | 9 | public boolean setField(int x, int y, char player) {
if (x > 4 || x < 1 || y > 4 || y < 1) {
return false;
} else {
for (int i = 1; i < field.length + 1; i++) {
for (int j = 1; j < field[i - 1].length + 1; j++) {
if (((i == y) && (j == x) && fi... |
87bb736a-6a6a-4287-ad3b-60f2fa155b29 | 1 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
return getBumoncode() == ((Bumon) obj).getBumoncode();
} |
b8bde2e8-1d10-46c8-9c66-9dd5c288576c | 8 | protected Boolean tryCheckVLine5(boolean update) {
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
int count = (gemArray[i][j]);
if (j + 4 <= 5) {
if (count == gemArray[i][j + 1] && count == gemArray[i][j + 2] && count == gemArray[i][j ... |
ede9a41a-8390-4f49-b943-274e69a32088 | 1 | public boolean equals(Pair o) {
return o.x == x && o.y == y;
} |
0ad63cc8-ea6f-4d40-afb9-eccfa1108e3c | 7 | public static void setMatrix(int[][] matrix){
boolean[] row = new boolean[matrix.length];
boolean[] column = new boolean[matrix[0].length];
for(int i = 0; i < matrix.length; i++){
for(int j = 0; j < matrix[0].length;j++){
if(matrix[i][j] == 0){
row[i] = true;
column[j] = true;
}
}
}
... |
89e002d1-eb0c-477d-b921-81bf487acd15 | 4 | public void MakeMove(int r1, int c1, int r2, int c2)
{
this.cell[r2][c2] = this.cell[r1][c1];
this.cell[r1][c1] = CellEntry.empty;
// Promote To King
if(this.cell[r2][c2].equals(CellEntry.white) && r2==rows-1){
this.cell[r2][c2] = CellEntry.whiteKing;
... |
83c54dc4-b1db-4870-8575-6a321fb564b7 | 5 | private boolean executarCommand(Operation op, Object object){
int updatedRows = -1;
switch(op){
case INSERIR:
updatedRows = inserir(object);
break;
case ATUALIZAR:
updatedRows = salvar(object);
break;
cas... |
4ac19287-5bb4-474c-b0b8-aeb23dc2e8c9 | 8 | @Override
public boolean evaluate(Work w) {
int i;
int j;
int limit;
int prime;
int number_of_primesX = 0;
int number_of_41primesX = 1;
int number_of_43primesX = 0;
System.out.println("Thread " + lc_omp.omp_get_thread_num() + ": " + w.start + " - " + w.end);
for (i = w.start; i <= w.end; i += 2)... |
77248432-1a24-4c73-b175-11fe5f0fea28 | 8 | public Object calculate(GraphModel g) {
SubGraph sg = new SubGraph();
int limit=r2.nextInt(g.getEdgesCount());
Vector<Integer> vi = new Vector<Integer>();
HashMap<Vertex,Vertex> vv= new HashMap<Vertex, Vertex>();
for(int i=0;i<g.getVerticesCount();i++) {
vi.add(i);
... |
f397d12d-a7a5-41f3-8080-26b2074efcc5 | 6 | private void quickSortDate(int low, int high) {
int i = low;
int j = high;
java.util.Date pivot = tabledata.get(low + (high - low) / 2).getOrder().getFullDate();
while (i <= j) {
while (tabledata.get(i).getOrder().getFullDate().before(pivot)) {
i++;
... |
b1716ad7-0a85-44ab-ac9e-ecaabbfc4e3e | 3 | public void rebuild() {
for (int x = 0; x < sizeX; x++) {
for (int y = 0; y < sizeY; y++) {
for (int z = 0; z < sizeZ; z++) {
vertices.add(new Vertex(new Vector3f(x, y, z + BLOCKSIZE)));
vertices.add(new Vertex(new Vector3f(x + BLOCKSIZE, y, z + BLOCKSIZE)));
vertices.add(new Vertex(new Vector3f... |
06f48f52-e8c8-4757-819d-10612ad7308c | 7 | @Override
public void stateChanged(ChangeEvent args) {
if(args != null && args instanceof GetDatabySubjectPanelChangeEvent) {
try {
Document doc = this.getRequest().getDocument();
this.updateRequest(doc);
} catch (Exception e) {
// TODO: log this.
}
}
super.stateChanged(args);
try... |
8ad41d82-87d2-49e4-8bee-ee984b9e4f7e | 1 | public void run(){
try {
//SqlSession session = RequestDataSessionManager.getRequestSession();
//DataMapper mapper = session.getMapper(DataMapper.class);
JDBCConn();
//session.commit();
} catch (SQLException ex) {
Logger.getLogger(testDB.cla... |
cef8502a-6fa0-4734-95f0-e99aa2bea234 | 1 | private void populateWorld() {
for (int i = 0; i < this.size * CREATURES_ON_SQUARE; i++) {
Random random = new Random();
this.creatures.add(new Creature(square[0], random.nextInt(100), random.nextInt(100)));
System.out.println(this.creatures.get(i).toString());
}
... |
091096a3-4aaf-4969-b51b-0f88a8e6295a | 6 | public void directionForce(final int x){
if(pointChargePosX >= particleXpos && pointChargePosY < particleYpos){
electroForce.setEndX((particleYpos+(particleCharge()*230))/slopeLine);
electroForce.setEndY(((slopeLine*particleXpos)-(particleCharge()*230)));
}
if(poin... |
a61e74fb-4071-49be-9844-96c36a934634 | 7 | private float[] getComputedWindow() {
int ix=(blockFlag?4:0)+(previousWindowFlag?2:0)+(nextWindowFlag?1:0);
float[] w=windows[ix];
if(w==null) {
w=new float[n];
for(int i=0;i<leftN;i++){
float x=(float)((i+.5)/leftN*Math.PI/2.);
x=(float)Math.sin(x);
x*... |
637fdd0e-df00-44c3-b7b1-ca187310f02e | 1 | @Override
public void KeyDown(int key, char c) {
// TODO Auto-generated method stub
if(key == Input.KEY_F2) {
GameInfo.SHOW_DEBUG_INFO = !GameInfo.SHOW_DEBUG_INFO;
}
} |
aa3ea274-6e8f-4a51-b77a-7b4fcaaccf5b | 8 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if((affected==null)
||(!(affected instanceof MOB))
||(((MOB)affected).amDead())
||(((MOB)affected).amFollowing()==null)
||(((MOB)affected).amFollowing().amDead())
||((hasFought)&&(!((MOB)affected).isInCombat())))
{
unInvoke();
return fa... |
2aa12ad6-1234-4d97-8db4-dfc7840cf9b1 | 3 | private void populate()
{
if (isPopulated == false) {
for (int y = 0; y < gridSize; y++) {
for (int x = 0; x < gridSize; x++) {
squares[x][y] = new Square(this, x, y);
}
}
isPopulated = true;
}
} |
b754058e-d4ec-4f6e-93b3-2a7e1faaa124 | 9 | private void jButtonGuardarNovoFornecedorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarNovoFornecedorActionPerformed
// BOTAO GUARDAR NOVO FORNECEDOR -> JANELA NOVO FORNECEDOR
String nome = jTextFieldNomeFornecedor.getText();
String morada = jTextFieldMoradaFor... |
9d4c19ed-d48e-4dc3-81e6-a7a527b1006e | 7 | private void method289(InteractiveObject interactiveObject) {
for (int x = interactiveObject.x; x <= interactiveObject.anInt524; x++) {
for (int y = interactiveObject.y; y <= interactiveObject.anInt526; y++) {
GroundTile groundTile = groundTiles[interactiveObject.z][x][y];
if (groundTile != null) {
fo... |
96ef5d6e-571f-4eeb-8c4e-a7193a31fb9d | 5 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + (bgToOamPriority ? 1231 : 1237);
result = prime * result + (flipHorizontally ? 1231 : 1237);
result = prime * result + (flipVertically ? 1231 : 1237);
result = prime * result + ((palette == null) ... |
54eb78e4-5512-440c-a20e-8aa36a3fee6d | 6 | private int method465(Model model, int i)
{
int j = -1;
int k = model.anIntArray1627[i];
int l = model.anIntArray1628[i];
int i1 = model.anIntArray1629[i];
for(int j1 = 0; j1 < anInt1626; j1++)
{
if(k != anIntArray1627[j1] || l != anIntArray1628[j1] || i1 != anIntArray1629[j1])
continue;
j = j1;
... |
b72a9236-4157-40b9-a238-48391b62d42a | 7 | public Edge addPhraseStructureEdge(PhraseStructureNode parent, PhraseStructureNode child) throws MaltChainedException {
if (parent == null || child == null) {
throw new MaltChainedException("Parent or child node is missing in sentence "+getSentenceID());
} else if (parent.getBelongsToGraph() != this || child.get... |
3ddfd241-d62c-49ba-9354-9f4dbbe84ce5 | 8 | public static Adventurer setupPlayer(){
Adventurer player;
Random r = new Random();
Scanner s = new Scanner(System.in);
System.out.println("New player! What will be your adventurer's name?");
String name = s.nextLine();
System.out.println("\nWelcome, " + name + "! Choose a class:\nA : Warrior\nB : Wizard\nC : Ro... |
6e68032c-638b-4bf9-8ecf-402bf1dd0dea | 3 | void star2() {
int rows = 5;
for (int i = rows -1; i >= 0; i--){
for (int j = 0; j < i; j++){
System.out.print(" ");
}
for (int j = (rows - i) * 2 - 1; j > 0; j--){
System.out.print("*");
}
System.out.println();
... |
03b75e19-5f6f-4792-829a-dff7137529b8 | 2 | public void recall()
{
if(isReadOnly()) return;
try { fdbf.seek( recordpos() ); } catch (IOException e) {}
writeChars(0,1," "); deleted = false;
} |
f9bdad9e-2d08-40cc-9937-01f9673eb25d | 3 | public String addFile( String filename, String alt_filename, String mimetype, METSMetadata md ) throws Exception {
// read in the file
File fileobj = new File( filename );
InputStream is = new FileInputStream(fileobj);
long length = fileobj.length();
byte[] arr = new byte[ (int) length ];
// Read in the bytes
... |
24646c99-072c-4ce7-9ec3-b33af9b951cb | 7 | public <V> Adapter.Setter<V> makeSetter(String methodName, Class<V> _class) {
try {
T version = (T) start.get().newVersion;
final Method method = version.getClass().getMethod(methodName, _class);
return new Adapter.Setter<V>() {
public void call(V value) {
try {
Trans... |
57064c68-5103-4dfd-b5ee-1eeb4ad18dae | 4 | public static void read(String fileName) {
System.out.println("read start");
SAXBuilder builder = new SAXBuilder();
try {
Document document = builder.build(fileName);
Element root = document.getRootElement();
List<?> list = root.getChildren();
for (int i = 0; i < list.size(); i++) {
Element teache... |
58d46ce3-f00f-4313-845c-246a5859fbdc | 7 | public final void updateMode()
{
// WE'LL NEED THESE GUYS
Poseur singleton = Poseur.getPoseur();
PoseurStateManager state = singleton.getStateManager();
PoseurState mode = state.getMode();
PoseurFileManager fileManager = singleton.getFileManager();
// IN THIS MODE TH... |
e13dfd67-ad4f-4d3d-9d13-0ff1153b9380 | 2 | private void buildTree(Document doc, Element root) {
doc.setXmlStandalone(true);
doc.setStrictErrorChecking(true);
doc.setXmlVersion("1.0");
Element subRoot;
Element e;
subRoot = createElement(doc, "Towns", null);
for(Town i: towns){
... |
97b4f35f-61a5-489a-9d05-bd37c422f7bb | 1 | public static void addIntegers(List<? super Integer> list){
list.add(new Integer(50));
} |
2a031d71-ae27-4582-a852-bfa703729cea | 2 | public static void main(String[] args) {
/* program to print the pattern
*
**
***
****
*/
for (int i=0;i<=5;i++)
{
for (int j=0;j<=i;j++)
System.out.print("*");
System.out.println("");
}
} |
58fd8ec8-107a-4a6f-a5a7-f0145543acd1 | 9 | @Test
public void testGitHubSignIn()
{
// I *could* put my actual name and password here, but for obvious security reasons,
// the only use case where I would would be if I had a test account, not a real one.
page.clickOnSignInButton();
SignInPage signInPage = PageFactory.initElements(webDriver, SignInPage... |
b5bce000-985e-423e-9a59-d9cdd7880641 | 9 | private Space[] getNeighbors(){
Space[] ret=new Space[4];
for (int i=0; i<ret.length;i++){
if (i==0){
if (!(_r==0)){
ret[i]=maze[_r-1][_c];
}
}
if (i==1){
if (!(_c==maze[0].length-1)){
ret[i]=maze[_r][_c+1];
}
}
if (i==2){
if (!(_r==maze.length-1)){
ret[i]=maze[_r+... |
bf64fa48-84cc-460a-9072-30ccdd375f64 | 3 | public void testQuery(String query, int numCols)
{
// try the following
try {
// open the connection to the database
Connection connection =
DriverManager.getConnection(this.urlStr);
// create a statement
Statement statement = connection.createStatement();
... |
68ebe9b5-e154-49ca-b8ec-ffc794aeca5f | 6 | public static int countBacklinksOnRelation(Stella_Object self, Keyword kind, Surrogate relation) {
{ BacklinksIndex index = Logic.getBacklinksIndex(self);
Cons equivalents = (Stella_Object.isaP(self, Logic.SGT_LOGIC_LOGIC_OBJECT) ? ((LogicObject)(self)).variableValueInverse() : Stella.NIL);
int count = ... |
c860b3b5-3088-4919-95ae-a3007d2317fa | 3 | private ResTable_Entry readEntryTable(byte[] data, int offset) throws IOException {
// The exact type of entry depends on the size
int size = readUInt16(data, offset);
offset += 2;
ResTable_Entry entry;
if (size == 0x8)
entry = new ResTable_Entry();
else if (size == 0x10)
entry = new ResTable_Map_Entr... |
f04761fe-2aee-43e7-9498-124a8c09b70a | 9 | private static Holder runATrial(MetaboliteClass metabolite, String phyla, OtuWrapper wrapper, List<String> keys,
boolean scramble)
throws Exception
{
int otuIndex = wrapper.getIndexForOtuName(phyla);
HashMap<Integer, List<Double>> metaboliteMap = WriteTrialsForSVMLight.getMetabolites(metabolite, scramble);... |
33421dc8-cf41-4261-843c-133f9ae9d2b3 | 8 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while (in.hasNextInt()) {
int n = in.nextInt();
if ( (n % 2) == 0 ) {
System.out.println("2^? mod " + n + " = 1");
continue;
}
long s = 1;
boolean b = false;
for( int i = 1;i <n;i++) {
if ( (i * 2 % n... |
315c19f9-f8d1-4644-9092-7938a1394d15 | 8 | private void insertClusterSequence ( ClusterSequence cs, float offSet) {
//
int scoreIndex=0;
float clusterTime;
for ( int i=0; i < cs.getClusterNumber() ; i++ ) {
clusterTime=cs.getTimeAtStep(i)+offSet;
System.out.println(clusterTime+"eccolo");
for (int j=scoreIndex; j < score.getCl... |
5890a102-bdc7-4683-b4d8-f728c7959a10 | 1 | public final double getTotalBeforeDiscount() {
double total = 0.0;
for (LineItem item : lineItems) {
total += item.getProductAmount();
}
return total;
} |
e4309cf5-0503-4aae-acae-5354275b7f2c | 9 | private void sort()
{
for(File f : rootDir.listFiles())
{
if(f.isDirectory() && !f.equals(outputDir))
{
for(File f1 : f.listFiles())
{
if(f1.isDirectory())
continue;
String[] split = f1.getName().split("\\.");
if(split.length > 1 && split[1].equalsIgnoreCase(extension... |
cfc06e0d-5bf6-42ed-9c68-65d6428278fe | 2 | private void bNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bNewActionPerformed
TextEnterDialog dg = new TextEnterDialog(this, true);
dg.setLocationRelativeTo(this);
dg.setVisible(true);
if (dg.getReturnStatus() == TextEnterDialog.RET_ADD) {
mapShapes(... |
03b0da86-d6d6-4450-91ea-28f893a49150 | 0 | @Override
public String getDef() {
return convertToString(def);
} |
d258dd80-913f-41c1-ae58-f3f287fdc644 | 2 | public void render()
{
for(GuiButton button : buttons)
{
button.render(g);
}
for(Particle p : particles)
{
p.render();
}
renderText(new Font("Arial", Font.BOLD, 18), Color.white, Game.WIDTH - 120, 15, "Frames: " + Game.getFPS());
renderText(new Font("Arial", Font.BOLD, 18), Color.white, Gam... |
51c38b58-316f-4c34-9ae0-f9a54e5f0e86 | 1 | public Vector toVector() {
Vector<E> vec = new Vector<E>(array.length);
for (int i = 0; i < array.length; i++) {
vec.addElement(array[i]);
}
return vec;
} |
3f241e45-7330-4fff-89a7-47d5821faff7 | 8 | public boolean matches(InventoryCrafting par1InventoryCrafting)
{
ArrayList var2 = new ArrayList(this.recipeItems);
for (int var3 = 0; var3 < 3; ++var3)
{
for (int var4 = 0; var4 < 3; ++var4)
{
ItemStack var5 = par1InventoryCrafting.getStackInRowAndCo... |
7fd2c37f-a914-4e5a-b6b3-5c21ca7dcdc3 | 9 | public synchronized void run() {
int temps;
this.grille.setScore(this.grille.getScore() + 1); // des qu'une piece est placée sur le plateau, on augmente le score de 1
// tant que la partie n'est pas finie
while (!this.isFin()) {
// est ce qu'on triche ???
if (t... |
baf5c3ed-da51-4f65-9163-121ad1948f69 | 3 | private boolean isInnerElement(TreeItem sourceTreeItem, Object investigationItem) {
boolean isInnerElement = false;
assert sourceTreeItem != null;
if (investigationItem == null) {
return false;
}
if (sourceTreeItem == investigationItem) {
return true;
}
for (TreeItem childItem : sourceTr... |
9d3f1f2b-b928-4e63-bdb3-60054a989ad3 | 6 | public static void binarySearch(int[] arr, int data) {
if (arr.length < 1) {
System.out.println("null?");
return;
}
if (arr.length == 1) {
if (data == arr[0]) {
System.out.println("success.\t" + data + " -> arr[0]");
return;
... |
9395e1e4-73ad-43d6-8531-f76dfb93a113 | 6 | private void cherche_Base(){
ArrayList<Cellule> autour = curent.env.getenv(curent);
for (int i =0 ; i<autour.size() ; i++){
if (autour.get(i).objet != null){
if((autour.get(i).objet instanceof Forum)){
Forum b =(Forum ) autour.get(i).objet;
if (this.al != b.al && !b.perdu){
if (!this.a... |
917f8b5f-6ed1-4862-9db5-6e8c7ed5c492 | 2 | public void stop(){
if(running){
running = false;
try {
serverSocket.close();
} catch (IOException e) {
LOG.error("stop process server error", e);
System.exit(-1);
}
}
} |
704c98b3-dfa0-4826-8588-cf0e8eb03ee7 | 8 | @Override
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ReverseLookupList)) {
return false;
}
final ReverseLookupList<?> other = (ReverseLookupList<?>) obj;
if (decorated == null) {
if (other.decorated != ... |
90cdf4b9-d660-4d0b-ab66-d92d16953cad | 0 | public void setStation(Station value) {
this._station = value;
} |
3f5408f4-82c1-41c8-aa88-27a0b6e336e3 | 2 | public void InsertarDocumento(ArrayList datos)
{
// Cambiamos todos los datos, que se puedan cambiar, a minúsculas
for(int i = 0 ; i < datos.size() ; i++)
{
try{datos.set(i, datos.get(i).toString().toLowerCase());}
catch(Exception e){}
}
biblioteca.ins... |
6390631b-c1a9-4a55-8778-e83b3b7d0337 | 0 | public void setX(double x) {
this.x = x;
} |
7903d87e-ae51-4928-bafc-913d247171aa | 6 | public void run() {
ServerSocket serversocket = null;
Socket s;
InputStreamReader input;
BufferedReader b;
PrintWriter p;
String message = null;
boolean done = false;
try {
serversocket = new ServerSocket(Utils.FAULTMNGR_PORT, 1); /* backlog is 1 */
serversocket.setSoTimeout(0);
} catch (IOEx... |
50302a06-445a-4bc1-affd-eaf69cfe8434 | 3 | public void handleClick(int button) {
switch (button) {
case 1:
state = State.OBSTACLE;
break;
case 2:
state = State.START;
break;
case 3:
state = State.END;
break;
def... |
8e255cf1-1f42-4fec-999e-cd4b01f6a5f1 | 7 | public Ast.AstSchemaExpression parse_SchemaExpression(SpecObject specObject, String property)
{
int at = m_current;
if (!ok())
{
return null;
}
int tat;
if (next(TozeTokenizer.TOKEN_ALL))
{
Ast.AstForAllS node = m_ast.new A... |
0f440654-f08a-4779-a09c-3231e0dd39d3 | 0 | public String getMessage() {
return " a";
} |
38af37dd-93f4-41d8-8f5b-c79bb0037f81 | 2 | private static void loadAllTheCardImagesFromFileNames(String[] cardImageFileNames, MediaTracker tracker) {
String curDir = System.getProperty("user.dir");
Image pic;
for (int i=0; i < cardImageFileNames.length; i++) {
pic = Toolkit.getDefaultToolkit().getImage(curDir + "/cla... |
f74b8d9c-526a-4ab1-970f-65d20f22bfa7 | 2 | public int getPlayersPatronXP(String playerName) {
int patronsXP = 0;
String SQL = "SELECT `XP` " + " FROM " + tblAllegiance + " WHERE `player` LIKE ?";
Connection con = getSQLConnection();
try {
PreparedStatement statement = con.prepareStatement(SQL);
statement.setString(1, playerName);
ResultSet ... |
270fbde6-6939-484f-9a78-b86e1bfc46a8 | 3 | private static void insertionSort(int[] num) {
int j;
int key;
int i;
for (j = 1; j < num.length; j++) {
key = num[ j ];
for(i = j - 1; (i >= 0) && (num[ i ] >= key); i--) {
num[ i+1 ] = num[ i ];
}
iSwaps++;
num[ i+1 ... |
2e43bbe7-205e-4748-9214-618ba992f259 | 7 | public Node findLoopStart(Node head) {
Node fast = head;
Node slow = head;
while (fast != null && fast.next != null) {
fast = fast.next.next;
slow = slow.next;
if (fast == slow) {
break;
}
}
if (fast != slow)
return null;
slow = head;
while (slow != null && fast != null) {
if (slo... |
7aa35d92-4832-43d7-98bc-ec02a034c99a | 2 | public void addCard(Card card, boolean position) {
if (position == TOP) {
cardPile.addFirst(card);
}
else {
cardPile.addLast(card);
}
if (component != null) {
component.updateTopCard();
}
} |
f9b488a0-b7c8-4573-be08-2b8e92bafd8b | 0 | public int getId() {
return id;
} |
4e553521-6108-466f-b865-172e1082ec68 | 7 | public static boolean isVersionGreaterThan(String isThis, String greaterThanThis){
int A[] = parseVersion(isThis);
int B[] = parseVersion(greaterThanThis);
if(A[0] > B[0]){
return true;
}
if(A[0] == B[0]){
if(A[1] > B[1]){
return true;
}
if(A[1] == B[1]){
if(A[2] > B[2]){
return true;... |
6b372859-2f8a-4c57-9f14-3a54ebfc26a7 | 0 | public LRParseTableAction(GrammarEnvironment environment) {
super("Build SLR(1) Parse Table", null);
this.environment = environment;
this.frame = Universe.frameForEnvironment(environment);
} |
8aa54e70-8e8d-4fd2-9cba-728b9257d522 | 3 | public static boolean isValidationKeyPressed(){
return (keyState[SPACE] && !prevKeyState[SPACE]) || (keyState[ENTER] && !prevKeyState[ENTER]);
} |
1e9ab658-57b1-49d7-9502-7e08bfaf6f5f | 9 | @Override
public final void connect() throws CommunicationError, ConnectionException {
synchronized(_lock) {
if(_isConnected) {
throw new RuntimeException("Verbindung zum Datenverteiler besteht bereits.");
}
if(_dataModelConnection != null) {
_dataModelConnection.connect();
_dataModel = _dataMod... |
e706ce79-e053-424e-b475-5dadecb1f635 | 1 | public AuctionOntology() {
super(ONTOLOGY_NAME, BasicOntology.getInstance());
try {
//Add Concepts
ConceptSchema cs = new ConceptSchema(GOOD);
add(cs, Good.class);
cs.add(GOOD_NAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
cs.add(GOOD_PRICE, (PrimitiveSchema)... |
af34f88e-2615-4d94-a6d5-5527ef5a73a0 | 1 | @Override
protected Element getSpecificDataXML() {
Element e = new Element("Album");
if (coverUrl != null) e.setAttribute("coverUrl", coverUrl.toString());
// if (moreInfo != null) e.setAttribute("moreInfo", moreInfo);
return e;
} |
b167f927-b955-479b-88b2-52d385cad38f | 9 | private Point[] chooseRandomCentres(int k, int n, int d, Point points[]) {
//array to store the choosen centres
Point[] centres = new Point[k];
//choose the first centre (each point has the same probability of being choosen)
int i = 0;
int next = 0;
int j = 0;
... |
38be3061-6d37-466a-9553-337024da936c | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=prof... |
aea6de7b-fd37-4429-aff3-55e5617a8f8d | 4 | public static double Distance2Objects (ABObject o1, ABObject o2)
{
List<Point2D> pointsO1 = MathFunctions.getObjectContourPoints(o1);
List<Point2D> pointsO2 = MathFunctions.getObjectContourPoints(o2);
double error_distance = 2.0;
double min_distance = 999.0;
for (int i = 0; i < pointsO1.size(); i++)
{
... |
85edaece-ec8e-4767-9a41-f7e9915b984e | 6 | private void parseType() throws SyntaxError {
switch(currentToken.kind) {
case Token.BOOLEAN:
case Token.VOID:
acceptIt();
break;
case Token.IDENTIFIER:
parseIdentifier();
if(currentToken.kind == Token.LBRACKET) {
acceptIt(... |
b47e8d38-343d-4fe2-b047-7cd7c4f44da9 | 3 | private static void selectionSort(Items[] items) {
for (int pass = 0; pass < items.length-1; pass++) {
// System.out.println(pass + "-" + items[pass]);
int indexOfTarget = pass;
int indexOfSmallest = indexOfTarget;
for (int j = indexOfTarget+1; j < items.length; j... |
9490332a-4a1c-4524-b857-c3bfe90cd60d | 3 | public void validate(){
if ( personBean.getFirstName().length() == 0 ){
addFieldError( "personBean.firstName", "First name is required." );
}
if ( personBean.getEmail().length() == 0 ){
addFieldError( "perso... |
b19c65cc-03b3-47d4-a656-e9aef38df798 | 9 | @SuppressWarnings("rawtypes")
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null) return false;
if (getClass() != obj.getClass()) return false;
NameValuePair other = (NameValuePair) obj;
if (k == null) {
if (other.k != null) return false;
} else if (!k.equals(ot... |
311367b7-8326-40f9-8233-b5273c338d31 | 9 | public void draw(UShape shape) {
// System.err.println("inter=" + shape.getClass());
if (shape instanceof Ftile) {
final Ftile tile = (Ftile) shape;
final Set<Swimlane> swinlanes = tile.getSwimlanes();
final boolean contained = swinlanes.contains(swimlane);
if (contained) {
tile.drawU(this);
// ... |
19746056-b0a6-4331-9a0d-0ab60626a846 | 6 | @Override
protected void idle() {
boolean moved=false;
switch(facing) {
case UP: moved=move(x, y-1); break;
case DOWN: moved=move(x, y+1); break;
case LEFT: moved=move(x-1, y); break;
case RIGHT: moved=move(x+1, y); break;
}
Random r = new Random();
if(!moved || r.nextInt(8) == 0)
facing = r.nextI... |
2d450092-2df6-4d8d-82be-4f350cbffe59 | 1 | public final Instruction getPrevByAddr() {
if (prevByAddr.opcode == opc_impdep1)
return null;
return prevByAddr;
} |
974eae42-ed3b-41be-922a-2f827f2e979b | 8 | private static void recursiveParse(Corpus corpus, Element element, boolean includeTokensWithNonAToZ) {
NodeList nodeList = element.getChildNodes();
for (int i=0; i<nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node instanceof Element) {
Element el = (Element) node;
switch (el.getN... |
81bdb228-a90b-4714-9a79-cb7c155bb9fd | 0 | public long getSequence() {
return this._sequence;
} |
4fb1fa46-624b-4cc9-91db-1c01b4ac7713 | 9 | public static void main(String[] args)
{
int index = 0;
URL url = Driver.class.getResource("kap1.txt");
In input = new In(url);
TwoThreeTree<String, Value> tree = new TwoThreeTree<String, Value>();
Value v = null;
while (!input.isEmpty())
{
String line = input.readLi... |
7d3ae6de-493f-4eb3-b505-5495674396b2 | 3 | private static int skipUTF8Char(byte b){
if((byte)(b&0x80)==0) return 1;
if((byte)(b&0xe0)==(byte)0xc0) return 2;
if((byte)(b&0xf0)==(byte)0xe0) return 3;
return 1;
} |
8e8cc203-241a-46b1-ac9d-27aa1d1029ec | 3 | @Test
public void coloursWhenShapeRotates() {
BoardGui board = new BoardGui(30, 10);
board.addNewShape(new LShape());
board.getBoard().rotateShapeAntiClockwise();
int[][] cells = board.getBoard().mapper.getShape().getLayoutArray();
for (int row = 0; row < cells.length; row++)... |
adb48982-c03a-41fc-85d6-fe47b4947343 | 5 | public static void main(String[] args)
{
BaseSetting bs = new BaseSetting();
Wording w = new Wording("Je suis un énoncé", new Object[10]);
if (w != null) {System.out.println("WORDING NOT NULL");}
// INSERTION WORDING
w.insert(bs);
i... |
791c0181-2063-485a-8334-919c5bf42c1e | 0 | static void tune(Instrument instrument) {
instrument.play(Note.C_SHARP);
} |
515ba9c0-0192-4702-b48a-02fdc2590944 | 8 | @SuppressWarnings("unchecked")
private ClassNode newConcreteTrait(final TraitInfo info) {
final Type interfaceType = Type.getType(info.getInterfase());
final Type superType = Type.getType(info.getImplementation());
final String implName = superType.getInternalName();
final ClassNode cn = new ClassNode();
fin... |
61953cea-90ef-436d-9df4-a469d3ee8373 | 8 | public PlayerNumber winner() {
// @@@ quit function use
if (someoneQuit) {
return onePlayerLeft;
}
if (containsInt(moves1, 2) && containsInt(moves1, 5)
&& (movesLeft() != 0)) {
return FIRST_PLAYER;
}
if (containsInt(moves2, 2) && containsInt(moves2, 5)
&& (movesLeft() != 0)) {
return SECOND... |
899a7f9e-2749-4e7c-8c4e-d0e8189e55ed | 8 | private void jBtnSubmitModActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBtnSubmitModActionPerformed
DateFormat df = new SimpleDateFormat("M/d/yy", Locale.ENGLISH);
DateFormat tf = new SimpleDateFormat("h:mm a", Locale.ENGLISH);
CourseSection section;
ArrayList<MeetingDay> d... |
a4579b3d-e4d5-4e6a-a1a1-6b68f3ec710b | 3 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
fillBox(1000);
while ((line = in.readLine()) != null && line.length() != 0) {
int nCase = Integer.parseInt(line.tr... |
bfd0bc71-5400-40d5-b9bb-2c523b8efe64 | 5 | public void register(HttpServletRequest request, HttpServletResponse response) {
try{
//request.setCharacterEncoding("UTF-8");
//response.setCharacterEncoding("UTF-8");
//JSPȡûϢ
String name = new String(request.getParameter("username").getBytes("ISO-8859-1"),"UTF-8");
String pass =request.getParameter(... |
e96f44f6-62a0-4c8f-ac7d-190dd61890a9 | 7 | public void caseAVariableOccursFixedOrVariable(AVariableOccursFixedOrVariable node)
{
inAVariableOccursFixedOrVariable(node);
if(node.getDataName() != null)
{
node.getDataName().apply(this);
}
if(node.getOn() != null)
{
node.getOn().apply(this)... |
516e9b36-3404-4240-9a04-b86150a31820 | 3 | public void buildXmlDocument() throws Exception {
System.out.println(entryList);
System.out.println(file);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
... |
a5b04c7d-3bd6-4851-a600-63753654223a | 4 | public static void main(String[] args) {
NKeyMap<String, String> map = new NKeyHashMap<String, String>();
for(int i = 0; i < 3; i++){
Double longitude = Math.random();
String latitude = ""+Math.random();
String height = ""+Math.random();
String value = "I am multi key value longitude: '" + longit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.