method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
a18a6c03-5f1a-463b-9f80-d97935a95eac | 9 | public EditInfo getEditInfo(int n) {
//My code
if (n == 0) {
EditInfo ei = new EditInfo("", 0, -1, -1);
ei.checkbox = new Checkbox("Bit 0 set", (data & 1) != 0);
return ei;
}
if (n == 1) {
EditInfo ei = new EditInfo("", 0, -1, -1);
... |
8c2314f7-fc12-458b-a6ce-b9b3b0c1082b | 7 | private void add(char c){
c-=minChar;
int current = N++;
length[current] = length[last]+1;
link[current] = nil;
for(; last!=-1 && to[c][last]==nil; last = link[last]) to[c][last] = current;
if(last!=-1){
int p = to[c][last];
... |
ee1b2bad-d3c1-4ebd-86b2-334be69460e5 | 4 | public static void main(String[] av) throws Throwable {
DatabaseManager dbManager = new DatabaseManager("/Users/bod/Tmp/dbpedia.db");
// dbManager.insert("test", "Hello, World!");
BufferedReader reader = new BufferedReader(new FileReader("/Users/bod/Tmp/short_abstracts_en.nt"));
... |
c38fcf06-6657-42f2-88ab-179e1383c4e4 | 8 | public void search (BayesNet bayesNet, Instances instances) throws Exception {
m_random = new Random(m_nSeed);
// determine base scores
double fCurrentScore = calcScore(bayesNet);
// keep track of best scoring network
double fBestScore = fCurrentScore;
BayesNet bestBayesNet = new BayesNet();
bes... |
ac58b9f9-1805-41b3-913f-c4d1bc35cdfc | 6 | private void setAnchoColumnas(JTable tabla){
JViewport scroll = (JViewport) tabla.getParent();
int ancho = scroll.getWidth();
int anchoColumna=0;
TableColumnModel modeloColumna = tabla.getColumnModel();
TableColumn columnaTabla;
for (int i = 0; i < tabla.getColumnCount()... |
910a7079-dc50-49f3-bb6f-e502bdc86003 | 3 | private static boolean existsMethod(Class clazz, String methodName, Class returnClass) {
for (Method method : clazz.getDeclaredMethods()) {
if (method.getName().equals(methodName) && method.getGenericReturnType() == returnClass) {
return true;
}
}
return false;
} |
06bd9332-8075-4e9f-b753-83653059aecc | 0 | private void fireDisconnectEvent(DisconnectEvent evt) {
fireClientDisconnectEvent(
new DisconnectOnServerEvent(this, (ISocketServerConnection) evt.getSource()));
getConnections().remove(evt.getSource());
} |
10e60ca7-3956-4592-8632-2c397e5d5d0c | 7 | public void findPath(int[] pathInfo)
{
//Initialize
this.x = pathInfo[0];
this.y = pathInfo[1];
this.mov = pathInfo[2];
this.team = pathInfo[5];
int dat[];
Queue<int[]> check = new LinkedList<>();
//Reset everything
clearPaths();
... |
2f6d034e-c8b0-4fdb-a327-d27d3a31f28b | 1 | public void insertCodeAt(final Object obj, final int i) {
if (this.isDeleted) {
final String s = "Cannot change a field once it has been marked "
+ "for deletion";
throw new IllegalStateException(s);
}
code.add(i, obj);
this.setDirty(true);
} |
0594ed6e-3fbc-42f4-9c55-a69cd73cc183 | 4 | public static void solve() {
taken = new boolean[61][61][61];
p = new int[181];
c = new int[181];
for (int i = 0; i < d.length; i++)
for (int j = 0; j < d.length; j++)
for (int k = 0; k < d.length; k++) {
p[d[i] + d[j] + d[k]]++;
if (!taken[d[i]][d[j]][d[k]]) {
taken[d[i]][d[j]][d[k]] = t... |
e9b5a904-48f8-45ac-8bd4-1764285eeb51 | 6 | private playObject shufflerTron(int[][] actionCards,
Random random,
playObject playData)
{
int currentCard=0;
int[][] shuffledActionCards=new int[actionCards.length][sizeOfCardArray-1];
for(int currentLength=shuffledAction... |
447fa213-d6be-4d0d-8d5a-de34cbf62b59 | 5 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException {
String page = ConfigurationManager.getProperty("path.page.edithotel");
resaveParamsSaveHotel(request);
try {
Criteria criteria = new Criteria();
Hotel hotel = (Hotel) request... |
dae833ad-62a7-4c65-92fb-0fa9f27d6bbc | 2 | public Table(Type type){
column[0] = "<th>Délka trvání</th>";
column[1] = "<th>Jméno úkolu</th>";
if (type == Type.RUNNING_TASKS){
this.type = type;
sql = Database.SELECT_RUNNING_TASKS;
title = "Právě probíhající úkoly:";
column[2] = "<th ... |
16513e36-a286-4232-b32f-6e1e242baf33 | 7 | public boolean isFound() {
if (length != toLocate.length) {
return false;
}
int cursor = tailPointer;
for (int i = toLocate.length - 1; i >= 0; i--) {
if (toLocate[i] != buffer[cursor]) {
return false;
}
cursor = decrement(c... |
e5d39e53-46b4-422c-84f7-109ce3f19926 | 1 | @Override
public synchronized void init() throws Exception {
if (!isActive()) doInit();
} |
2e2279bb-ed59-433d-be3d-b4261f904d02 | 4 | public String extractLastName(String fullName) throws InvalidNameException {
if (fullName == null || fullName.length() <= 1) {
throw new InvalidNameException();
}
String[] nameParts = fullName.trim().split(" ");
if (nameParts.length > 2) {
nameParts[1] = nameParts... |
5c4ac332-5eef-4ca9-a0ec-5c50c551c2e9 | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BasicResourceGroup other = (BasicResourceGroup) obj;
if (definitions == null) {
if (other.definitions != null)
return false;
} else if (... |
b5cb772b-e87a-4c00-ba9b-1abeabe09457 | 1 | public void export() {
boolean done = (pToT.size() - alreadyDone.size()) == 0;
if (!done) {
javax.swing.JOptionPane.showMessageDialog(parent,
"The conversion is not completed yet!");
return;
}
Automaton toExport = (Automaton) automaton.clone();
gui.environment.FrameFactory.createFrame(toExport);
} |
cc9b556b-6df1-4f9c-acfd-a1e30e902b70 | 8 | public Direction nextClockwise() {
String direction = this.toString();
Direction nextDirection = null;
if (direction.equals("n")) {
nextDirection = Direction.newDirection("ne");
} else if (direction.equals("ne")) {
nextDirection = Direction.newDirection("e");
} else if (direction.equals("e")) {
nextD... |
dc52a167-49ef-48f4-976c-64517ad8021e | 2 | public static void main(String[] args) {
String name = "Jack";
switch (name) {
case "Marshall" : System.out.println("Name is Marshall");
case "Hue" : System.out.println("Name is Hue");
// case null : System.out.println("Compilation error");
default: System... |
7f29e1a2-f13b-41e6-881b-0312484a3b8e | 3 | private void printCond(Node t, int n)
{
if (t.getCdr().isNull())
{
t.getCar().print(n+4, false);
System.out.println();
if (n > 0)
{
for (int i = 0; i < n; i++)
System.out.print(" ");
}
t.getCd... |
1a95217d-31fe-4cc9-bc37-1a77ab669062 | 9 | private void listener() throws IOException, WarDoesNotExistException, WarAlreadyFinishedException, WarAlreadyStartedException, InvalidUnitNameException, PlaceNotFreeToPlaceUnitException, UnitCoordinatesOutsideMatrixException{
boolean alive = true;
while(alive){
String inputLine;
inputLine = br.readLine();
... |
6b624463-a9f6-4e48-a912-bc1c8113e11d | 0 | @Override
public void setSector(String sector) {
super.setSector(sector);
} |
48e03295-1d6a-492f-bc11-55147bf9b4d4 | 6 | public int writeUsers() throws IOException {
set = new HashSet<Long>();
FileOutputStream fout = new FileOutputStream(outputFile);
ObjectOutputStream oos = new ObjectOutputStream(fout);
for (File file : fileList) {
System.out.println(file.getAbsolutePath());
ObjectInputStream ois = new ObjectInputStream(ne... |
9df3058d-0835-4a8b-ac81-4b9261fa91a0 | 6 | private void checkAggregation()
{
if(group!=null)
{
ExpressionDecomposer ed=new ExpressionDecomposer();
Iterator<Expression> s=select.iterator();
while(s.hasNext())
{
Expression e=s.next();
if(!e.getType().equals("sum") && !e.getType().equals("avg"))
{
ArrayList<String> selectAttrs=ed... |
779631d6-2417-4e71-84ed-c49e3997c39d | 3 | private int get(final int local) {
if (outputLocals == null || local >= outputLocals.length) {
// this local has never been assigned in this basic block,
// so it is still equal to its value in the input frame
return LOCAL | local;
} else {
int type = outputLocals[local];
if (type == 0) {
// this... |
82ed58b5-6a7a-44bf-9486-a0a682247e77 | 5 | private static Move BackwardRightCaptureForWhite(int r, int c, Board board)
{
Move backwardRightCapture = null;
if(r>=2 && c<Board.cols-2 && (
board.cell[r-1][c+1].equals(CellEntry.black) ||
board.cell[r-1][c+1].equals(CellEntry.blackKing)
... |
95c475ab-eb6a-4dd2-aa51-3691f8779bd5 | 1 | public void performAction(Component source){
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
if (g == null)
return;
MultipleSimulateAction mult = new MultipleSimulateAction(g, environment);
mult.performAction(source);
} |
a53b5803-551b-4be7-a713-19feb3c89d73 | 2 | public void freeze() {
Configuration[] configs = configurations.getSelected();
if (configs.length == 0) {
JOptionPane.showMessageDialog(configurations,
NO_CONFIGURATION_ERROR, NO_CONFIGURATION_ERROR_TITLE,
JOptionPane.ERROR_MESSAGE);
return;
}
for (int i = 0; i < configs.length; i++) {
config... |
f3003d80-b29b-478f-a585-295c74f1587b | 1 | public ResultSet getList(String whereString) {
StringBuffer sql = new StringBuffer("");
sql.append("SELECT SubSection_ID,Section_ID,SubSection_Name");
sql.append(" FROM `SubSection`");
if (whereString.trim() != "") {
sql.append(" where " + whereString);
}
SQL... |
7dbe8336-38cd-4664-91a9-5ea91fbe0efe | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof SurveyAttribute)) {
return false;
}
SurveyAttribute other = (SurveyAttribute) object;
if ((this.surveyAttribute... |
9fa13bd2-65a4-4e04-89e0-026d6c76c828 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Object")
public JAXBElement<ObjectType> createObject(ObjectType value) {
return new JAXBElement<ObjectType>(_Object_QNAME, ObjectType.class, null, value);
} |
02e0129a-e2bf-45b5-a7b1-a095c07e2f64 | 5 | public static String atbash(String code) {
char[] codeline = code.toCharArray();
String result = "";
for(int i = 0; i < codeline.length; i++) {
if(codeline[i] >= 'a' && codeline[i] <= 'z') {
codeline[i] = (char) ('z' - (codeline[i] - 'a'));
}
e... |
33c23d8d-5106-4223-8cd5-efd5d1aac088 | 2 | private void startQuiz()
{
QuestionPanel.removeAll();
this.repaint();
NextBtn.setVisible(true);
NextBtn.setText("Next");
if (quiz.navigationEnabled)
{
PrevBtn.setVisible(true);
PrevBtn.setText("Previous");
... |
dbb62e5f-26f7-41f6-9e8e-813265cbdbce | 9 | protected double generateClassValue(Instances data) throws Exception {
double result = Double.NaN;
switch (m_ClassType) {
case Attribute.NUMERIC:
result = m_Random.nextFloat() * 0.25
+ Math.abs(m_Random.nextInt())
% Math.max(2, m_NumNominal);
break;
... |
744f9b46-2c87-4e93-a474-abb7286a5d2e | 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... |
c10a64a0-920f-403c-a8d6-ae1b6d9ba006 | 6 | private static Asset loadAsset(String path, Class type) {
if (type == Model.class) {
try {
return ColladaLoader.loadFile(path);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printSta... |
bd2681f5-aac0-4e51-a642-2899f372be02 | 3 | public int removeDuplicates(int[] A) {
if (A.length == 0) return 0;
int n = 0;
for (int i = 1; i < A.length; i++) {
if (A[i] != A[n])
A[++n] = A[i];
}
return n + 1;
} |
ebf7be63-fc31-4fe2-ba00-33d4306f914e | 7 | public void onBlockRemoval(World par1World, int par2, int par3, int par4)
{
if (!keepFurnaceInventory)
{
TileEntityFurnace var5 = (TileEntityFurnace)par1World.getBlockTileEntity(par2, par3, par4);
if (var5 != null)
{
for (int var6 = 0; var6 < var5... |
735971ad-df56-40f2-b723-ae2884c42192 | 8 | @Override
public boolean runTest(){
return (makes10(9, 10) &&
!makes10(9, 9) &&
makes10(1, 9) &&
makes10(10, 1) &&
makes10(10, 10) &&
makes10(8, 2) &&
!makes10(8, 3) &&
makes10(10, 42) &&
makes10(12, -2));
} |
a0ed45a9-bd1a-4528-bb7e-259357d3b43b | 9 | @Override
public int run(String[] args) throws Exception {
if (args.length < 1) return -1;
if (args[0].equalsIgnoreCase("runcrawler")) {
int pageCount = 1;
if (args.length > 1) {
pageCount = Integer.valueOf(args[1]);
}
boolean outputContent = true;
if (args.length > 2) {
outputContent = (... |
97ac132d-a685-4aed-a94a-abad43c4fad8 | 6 | public static void main(String args[]) {
//<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://download.oracle.com/javase/tutorial/uiswing/loo... |
73ebd386-0b44-4f37-be5a-45c2eb99c648 | 4 | private void removeAVL(TreeNode startingNode, int searchingKey, int hash) {
currentSearchHeight++;
if (startingNode == null) {
System.out.println("\nKey " + searchingKey + " not found.");
return;
} else {
if (startingNode.key > searchingKey) {
removeAVL(startingNode.left, searchingKey, hash);
} el... |
25e8030d-39c7-4b13-9a7d-406e90d4128b | 1 | public void testCycConstant() {
System.out.println("\n*** testCycConstant ***");
try {
CycObjectFactory.resetCycConstantCaches();
assertEquals(0, CycObjectFactory.getCycConstantCacheByNameSize());
String guidString = TAME_ANIMAL.getGuid().getGuidString();
String constantName = TAME_ANIMA... |
7697cca4-888d-4347-88c7-13db16cccb58 | 9 | public String stSendEmailWithCaptcha(int dataId,int ExpVal,String flow )
{
int actVal=1000;
String returnVal=null;
hm.clear();
hm=STFunctionLibrary.stMakeData(dataId, "Email");
String action = hm.get("Action");
STCommonLibrary comLib=new STCommonLibrary();
Vector<String> xPath=new Vec... |
6fb27c01-8d6d-458d-9eb1-6a68d0e01ac9 | 7 | public ArrayList<Point> getLineFromBresenhamAlgo(int x0,int y0,int x1,int y1)
{
ArrayList<Point> newLine = new ArrayList<Point>();
int dx = Math.abs(x1 - x0);
int dy = Math.abs(y1 - y0);
int sx = x0 < x1 ? 1 : -1;
int sy = y0 < y1 ? 1 : -1;
int err... |
7d83d2b6-4fdd-4d46-b5cc-38613e5f6568 | 0 | public RedoTool(AutomatonPane view, AutomatonDrawer drawer) {
super(view, drawer);
} |
339fba1a-b6af-4ea6-acf5-565a391341dd | 0 | public byte[] getCipherValue() {
return cipherValue;
} |
86b47273-cf1b-40d2-b7be-f9bebcc1ce73 | 3 | @Override public Token clientCredentials(String... scopes) throws IOException {
final Request req = addScope(Request.to(Endpoints.TOKEN).with(
"grant_type", CLIENT_CREDENTIALS,
"client_id", mClientId,
"client_secret", mClientSecret), scopes);
final Token... |
cea80c20-78ed-424e-8fa0-074a972375c0 | 9 | void run(){
Scanner sc = new Scanner(System.in);
for(;;){
int n = sc.nextInt();
if(n==0)break;
int s = sc.nextInt();
int[] m = new int[2*n];
for(int i=0;i<2*n;i++)m[i]=sc.nextInt();
boolean[][] dp = new boolean[2*n][s+1];
for(int j=2;j<=s;j++)for(int i=0;i<2*n;i++){
boolean w = false;
f... |
e5b27279-0f3a-4212-b9f2-3f4325e68efd | 4 | private void setPesoLlaveEntera(int llave, double valor){
switch (llave) {
case 0:
this.setPeso(LONGITUD_SEPALO, valor);
break;
case 1:
this.setPeso(ANCHO_SEPALO, valor);
break;
case 2:
this.setPeso(LONGITUD_PETALO, valor);
break;
case 3:
this.setPeso(ANCHO_PETALO, valor);
... |
ed714a80-6556-42c5-ac74-fbeed0858092 | 9 | @EventHandler
public void onPlayerHit( EntityDamageByEntityEvent e ){
if( e.getEntity() instanceof Player ) {
Player p = (Player) e.getEntity();
if( e.getDamager() instanceof LivingEntity ) {
if (p.getInventory().getChestplate() != null) {
if (Stri... |
62d3c63e-5ea0-466a-bf59-ebacbdcbae8e | 1 | public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
try {
Spel spel = new Spel();
List<logic.Onderwerp> onderwerpen = spel.getOnderwerpen();
spel.setOnderwerp(onderwerpen.get(1));
spel.openPanel(new SpeelScherm(spel));
} catc... |
a6f2f7ff-4727-430e-af8d-b78650f48892 | 6 | public static void startupSoap() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/SOAP", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$, ((Module)(... |
fba6339f-9643-4e74-b71c-43b1f5cdb181 | 5 | @Override
public Matrix run(Matrix matrix, Matrix free) {
if (matrix.getWidth() != matrix.getHeight()) {
throw new IllegalArgumentException("matrix width != matrix height");
}
if (free.getWidth() != 1) {
throw new IllegalArgumentException("width != 1");
}
... |
0c066361-61c7-46d3-ba88-08a25f200123 | 8 | public static void main(String[] args){
int uniqueOdd[] = new int[29];
int uniqueEven[] = new int[9];
for(int i = 3; i <=31; i ++){
uniqueOdd[i-3] = i*(i+1);
}
int[] z = new int[1001];
for(int i = 2; i <=10; i ++){
uniqueEven[i-2] = 4*i*(2*i+1);
}
int k = 1;
for(int i = 0; i < uniqueOdd.lengt... |
15865cd0-51fd-4c3a-8d21-4360cae93dea | 4 | public boolean jumpMayBeChanged() {
return (thenBlock.jump != null || thenBlock.jumpMayBeChanged())
&& elseBlock != null
&& (elseBlock.jump != null || elseBlock.jumpMayBeChanged());
} |
45e23c82-0d89-4b29-a556-d058a2788567 | 6 | @EventHandler
public void BlazePoison(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getBlazeConfig().getDouble("Blaze.Poison.Dodg... |
fd8271db-342f-4ed7-a5e1-7fd37ec12f86 | 0 | public int getRow()
{
return x;
} |
c3f6ccea-5cad-4f76-8eaa-65d49e626ddf | 4 | public void componentMoved(ComponentEvent e) {
if(Debug.gui)
System.out.println(e.getComponent().getClass().getName() +
" --- Moved");
if(frame.getExtendedState()==JFrame.NORMAL && !fullScreenOn) {
preMaximiseBounds = frame.getBounds();
if(Debug.gui)System.out.println("compMoved:PreMaxBo... |
ad1c331f-392f-42f2-8bb2-6e2e67dafe58 | 3 | public int open(String path) {
if(path == null)
{
LOG.error("Open null path");
return -1;
}
try {
nc = NetcdfFile.open(path);
if( nc == null ){
LOG.error("OPEN FILE FAILURE");
return -1;
}
} catch (IOException e) {
e.printStackTrace();
}
return 0;
} |
ed917d1c-9f61-41d5-9d45-fd3d501fed34 | 2 | private void ensureNoPrimary() {
for( SelectableCapability selectable : site.getCapabilities() ) {
if( selectable.getSelected().isPrimary() ) {
selectable.setSelected( Selection.SECONDARY );
}
}
} |
3f831acb-c6c8-42e3-9f9c-6bf2f7d50e25 | 2 | public void updateVisibleObjects()
{
if(player.isOnline)
{
List<AreaObject> objectList = this.getVisibleObjects();
for (AreaObject areaObject : objectList) {
areaObject.addViewer(player);
}
}
} |
27f26616-7fc5-484b-92cd-2a3de971c2f7 | 5 | @Override
public void actionPerformed(ActionEvent e) {
if(!fileDirectory.equals("") && fileDirectory != null){
try{
File folder = new File(fileDirectory);
try
{
BufferedReader reader = new BufferedReader(new FileReader(folder.getPath()));
String line;
while ((line = reader.readLin... |
df425322-ed2a-4eba-9a7b-e5b0b8c4959b | 6 | public void tick() {
int Xa = 0;
int Ya = 0;
if (input.up.isPressed()) {
Ya--;
}
if (input.down.isPressed()) {
Ya++;
}
if (input.left.isPressed()) {
Xa--;
}
if (input.right.isPressed()) {
Xa++;
}
if (Xa != 0 || Ya != 0) {
move(Xa, Ya);
isMoving = true;
} else {
isMoving = fa... |
7355a830-1d4a-469f-9582-a626816d6352 | 4 | public void enter(){
threadEnter.start();
while (!threadEnter.getState().equals(Thread.State.TERMINATED)) {
if (gui.isAborted()) {
setTransportationState(TransportationState.ABORTED);
break;
} else {
try {
Thread.sleep(100);
} catch (InterruptedException e) {... |
8804f5a0-f315-40ae-8277-9c884b005e85 | 5 | static String [] split (String repeatable, char regex)
{
String [] elements;
String [] building;
int built = 0;
int length;
//int elementStart = 0;
int elementEnd = 0;
char pointed = ' ';
boolean inWord = false;
StringBuffer sinput = new StringBuffer ();
length = repeatable.length();
building ... |
e0845200-10a7-4427-b5cc-f4fa13f787cd | 2 | public static ParkingFacilityEnumeration fromValue(String v) {
for (ParkingFacilityEnumeration c: ParkingFacilityEnumeration.values()) {
if (c.value.equals(v)) {
return c;
}
}
throw new IllegalArgumentException(v);
} |
0032da7c-4a49-4814-847d-74d1dcfad5ed | 4 | public void moveUp(Area currentWorld){
for(int count = stats.speed; count > 0; count--){
if(currentWorld.locWalkable(x, y - size - 1)
&& currentWorld.locWalkable(x - size, y - size - 1)
&& currentWorld.locWalkable(x + size, y - size - 1)){
y--;
}
}
} |
339cfb38-8b7c-47f3-8041-a0d5a0515c4f | 1 | private void endBlock() throws IOException {
this.computedBlockCRC = this.crc.getFinalCRC();
// A bad CRC is considered a fatal error.
if (this.storedBlockCRC != this.computedBlockCRC) {
// make next blocks readable without error
// (repair feature, not yet documented, n... |
8844e403-a93f-4903-9ff2-4c45e65f10f4 | 8 | public Object nextValue() throws JSONException {
char c = nextClean();
String s;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
16c661e1-d2e7-4483-a499-dc03cfd2b5b2 | 3 | public static void unpackConfig(Archive archive) {
Stream stream = new Stream(archive.get("idk.dat"));
IdentityKit.length = stream.getUnsignedShort();
if (IdentityKit.designCache == null) {
IdentityKit.designCache = new IdentityKit[IdentityKit.length];
}
for (int j = 0; j < IdentityKit.length; j++) {
if... |
d44de87d-f058-4900-8e4e-65e6c195b38e | 6 | private void run()
{
isRunning = true;
int frames = 0;
long frameCounter = 0;
final double frameTime = 1.0 / FRAME_CAP;
long lastTime = Time.getTime();
double unprocessedTime = 0;
while(isRunning)
{
boolean render = false;
long startTime = Time.getTime();
long passedTime = star... |
48176669-15e5-4326-806d-16b019f60559 | 5 | private void txPesqNomeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txPesqNomeActionPerformed
String nome = txPesqNome.getText();
ConsultaController pc
= new ConsultaController();
modelo.setNumRows(0);
for (Consulta p : pc.listByNome(nome)) {
... |
143be551-3cea-416f-9f5f-e33eb2fc6f5f | 7 | private void btSalvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSalvarActionPerformed
Funcionario f = new Funcionario();
if (!(txId.getText().equals("") || (txId.equals(null)))) {
f.setId(Integer.parseInt(txId.getText()));
}
// u.setCodigo(Integer.p... |
a9e0af3b-ab64-43a7-a271-67759362ec6c | 0 | public void setName(String name) {
this.name = name;
} |
108a593e-103e-4656-9d32-c5d7c562e02b | 4 | public boolean canMove(float newX, float newY) {
if(newX <= 16 && newY <= 16) {
return false;
} else
if(newX <= 16) {
return false;
} else
if(newY <= 16) {
return false;
}
return true;
} |
b8176138-ac8a-430f-9d6e-0eb9dfd98b2c | 9 | private void joinGame() throws IOException {
processCommand(Operation.JOIN_GAME);
// Wait for an ack to know which port to finally communicate with.
byte[] receiveData = new byte[1024 * 100];
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
clientSocket.receive(receivePacke... |
85358035-3f57-4327-96e1-d5cf164768aa | 0 | public AnnotatedHandlerBuilder<Method> handleMethod()
{
return this.handleElement( Method.class );
} |
5266c480-cdca-4128-a413-c4cffebe5c9d | 9 | public void mouseClicked(MouseEvent me)
{
IsAnyMove(); // checkea si hay mas movimientos!
if(!this.canClick)
{
return;
}
//No se ha seleccionado nada previamente
if(this.firstClickedBlock == null)
{
//Le pongo un highlight al bloque y lo guardo
this.firstClickedBlock = (Bloque) me.getSource();
... |
aa061426-e811-474d-85fe-47af255939a4 | 4 | public Boolean pretarate() {
if (this.txt_num_estado.getText().matches("[1-9][0-9]*") && this.txt_num_simbolo.getText().matches("[1-9][0-9]*")) {
if (this.txt_num_estado.getText().length() != 0 && this.txt_num_simbolo.getText().length() != 0) {
this.prTable(Integer.parseInt(this.txt_... |
b1ec9a70-74cd-44c9-903a-bb9ccb1762c3 | 3 | public static ArrayList getATSA(String sa) throws SQLException {
ArrayList arr = new ArrayList();
ResultSet rs;
Connection conPol = conMgr.getConnection("PD");
if (conPol == null) {
throw new SQLException("Numero Maximo de Conexoes Atingida!");
}
String sql = ... |
484e2637-deea-42a2-9ba7-bd98efd6d2e1 | 8 | @Override
public Class<?> getColumnClass(int columnIndex)
{
switch (columnIndex)
{
case 0:
return Integer.class;
case 1:
return Order.class;
case 2:
return Date.class;
case 3:
return D... |
b54253d2-9178-4604-9317-389900549d1e | 5 | public void showLegend( boolean bShow, boolean vertical )
{
if( bShow && (legend == null) )
{
legend = Legend.createDefaultLegend( wb );
legend.setParentChart( chartobj.getParentChart() );
for( int j = 0; j < legend.chartArr.size(); j++ )
{
((GenericChartObject) legend.chartArr.get( j )).setParentC... |
de4067e4-0640-4851-ad05-0ed2560e76b6 | 8 | public Card makeSuggestion(int indexOfComputerPlayer, BoardCell room) {
JOptionPane.showMessageDialog(null, allPlayers.get(playerNumber).name + " is making a suggestion.");
Card someCard;
Card personCard;
Card roomCard;
Card weaponCard;
Random hazard = new Random();
ArrayList<Card> haveNotSeen = new Arra... |
0641f50f-91dc-465b-b007-eaee668a87f6 | 6 | public void atKeyword(Keyword k) throws CompileError {
arrayDim = 0;
int token = k.get();
switch (token) {
case TRUE :
case FALSE :
exprType = BOOLEAN;
break;
case NULL :
exprType = NULL;
break;
case THIS :
c... |
5cd0e0ce-890e-45f5-816d-3e56b1ee708e | 1 | private boolean newOperatorHasSameOrLowerPriority(String newOperator, String last) {
return isOperatorsHaveSamePriority(newOperator, last) || isFirstOperatorHasLowerPriority(newOperator, last);
} |
1761bfc5-a431-4b3e-b198-faf8627973d5 | 2 | @Override
public boolean hasNext() {
boolean hasNext = mIterator != null && mIterator.hasNext();
if (!hasNext) {
mIterator = null;
hasNext = mIndex < mList.size();
}
return hasNext;
} |
da68b115-46ef-493b-88d7-d41aedab6cc8 | 2 | public Term substitute(Term term, Term replacement) {
// If the user wants to substitute this variable, return the replacement.
if (getName() != null && equals(term)) {
return replacement;
}
return this;
} |
3ff0a7f7-8bfd-4c51-b348-a16bad786e05 | 2 | public static TeamMap getTeam(ChatColor color) {
for (TeamMap team : HyperPVP.getMap().getTeams()) {
if (team.getColor() == color) {
return team;
}
}
return null;
} |
0a5bfd40-3295-4cb8-9b36-d21c5f642d1b | 1 | public Object convertJavaToCyc(final Object term) throws ParseException {
if (!myClass.isInstance(term)) {
throw new IllegalArgumentException(
this + " can only convert objects of type " + myClass.getName() + ". "
+ term + " is of type " + term.getClass().getName());
} else {
... |
4a9e4353-af4e-42f5-a635-c06ad1a01255 | 5 | public void subIncrement(int nmult){
try {
if(allowedValue == null){
int n = this.getValue();
if(n - nmult*increment > vmax) {
n = vmax;
}else if(n - nmult*increment < vmin) {
n = vmin;
}else{
n -= nmult*increment;
n = increment * (int)( n / (double)increment + 0.5);
}
setN... |
3ab1b02f-46ff-480f-a290-c78c50bf0d52 | 6 | public static void main(String[] args){
Scanner s = new Scanner(System.in);
AudioFormat f= new AudioFormat(44100,8,1,true,true);
try{
SourceDataLine d = AudioSystem.getSourceDataLine(f);
d.open(f);
d.start();
String exitToken;
boolean morenote=true;
while(morenote){
d.flush();
Thread dr... |
6034b93a-b7cd-4961-8c15-eb1b89bf1385 | 5 | public void addEntry(Map<String, String> data,String tag){
/**
* addEntry: add tracks info into the json database file
* tag - String: This is a searchable string which should be
* unique and be used to identify this entry.
* data - Map<String,String>: This should contain key/value pairs
* of the data ... |
6683a080-6159-41e7-9290-3ef146a52e65 | 7 | private boolean canPlaceBlock(int x, int y, int z) {
switch (world.getBlockAt(x, y, z).getType()) {
case AIR:
case MOB_SPAWNER:
case CHEST:
case WATER:
case STATIONARY_WATER:
case LAVA:
case STATIONARY_LAVA:
retu... |
0d899707-40fc-405d-a227-99981ade9d5e | 8 | public static String majorToName(int d) {
if (d == 0x0000) {
return "Miscellaneous";
} else if (d == 0x0100) {
return "Computer";
} else if (d == 0x0200) {
return "Phone";
} else if (d == 0x0300) {
return "LANAccessPoint";
} else if (d == 0x0400) {
return "AudioVideo";
} else if (d == 0x0500)... |
9c4cbc54-dc87-4bf9-a5fb-7088d6c3be9d | 9 | public static void GemStone(String[] args) { //change name for main
Scanner in = new Scanner(System.in);
int numberOfTests = in.nextInt();
String[] tests = new String[numberOfTests];
for(int i = 0; i < numberOfTests; i++)
{
tests[i] = in.next();
}
Re... |
d5141bea-758a-4b8a-b36a-22c0daf7ce98 | 2 | public EncryptedHand encryptEncHand(EncryptedHand encHand) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException{
if (e == null) {
System.err
.println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)");
return null;
}
EncryptedHand ret = new EncryptedHand();... |
3c1a751d-e74c-4a9a-acfa-54599d990524 | 9 | private ArrayList<int[]> getSpaceSuggestions() {
// Creates the "Vehicle Entering" message and updates the counter
ZNetTxRequest message = new ZNetTxRequest(
XBeeAddress64.ZNET_COORDINATOR, new int[]{
'E', this.nextEntranceId, this.controllerId});
this.nextEntranceId++;
if (this.nextEntranceId > 255)... |
5554f67d-262f-4802-9392-da6f6163a448 | 7 | protected void doPrintHeader() {
append("<html>\n");
append("<head>\n");
append("<title>Predictions for dataset " + sanitize(m_Header.relationName()) + "</title>\n");
append("</head>\n");
append("<body>\n");
append("<div align=\"center\">\n");
append("<h3>Predictions for dataset " + sanitize... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.